
org.xlcloud.console.entitlements.EntitlementsDictionaryRepositoryStaticImpl Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2012 AMG.lab, a Bull Group Company
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xlcloud.console.entitlements;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import org.xlcloud.service.HttpAction;
import org.xlcloud.service.api.WebResourceRegistry;
/**
* Application scoped entitlement dictionaries static repository.
*
* @author Tomek Adamczewski, AMG.net
* @author "Konrad Król", AMG.net
*/
@ApplicationScoped
@Named
public class EntitlementsDictionaryRepositoryStaticImpl implements EntitlementDictionaryRepository {
private CompositeEntitlementDictionary mainDict;
private static Long lastId = 0l;
/**
* Fills in repository with static list of entitlement dictionaries.
*/
@PostConstruct
public void initializeDictionaryValues() {
mainDict = new CompositeEntitlementDictionary(lastId++, "entitlement.groups.all");
// entitlement.groups.accounts
CompositeEntitlementDictionary group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.accounts", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.accounts.list", group, "accounts/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.accounts.show", group, "accounts/*", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.accounts.create", group, "accounts", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.accounts.delete", group, "accounts/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.accounts.createGroup", group, "accounts/-*-/groups", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.entitlements", group, "accounts/-*-/groups/-*-/entitlements", HttpAction.values());
// entitlement.groups.entitlements
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.entitlements", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.tokens.list", group, true, "accounts/{accId}/users/{userId}/access-tokens/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.tokens.delete", group, true, "accounts/{accId}/users/{userId}/access-tokens/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.tokens.entitlements.show", group, true, "accounts/{accId}/users/{userId}/access-tokens/-*-/entitlements/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.tokens.entitlements.create", group, "accounts/{accId}/users/{userId}/access-tokens/-*-/entitlements", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.tokens.entitlements.delete", group, "accounts/{accId}/users/{userId}/access-tokens/-*-/entitlements/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.show", group, true, "accounts/{accId}/users/{userId}/entitlements/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.delete", group, "accounts/{accId}/users/{userId}/entitlements/-*-", HttpAction.DELETE);
// entitlement.groups.stacks
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.stacks", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.create", group, "accounts/{accId}/" + WebResourceRegistry.STACKS, HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.show", group, "accounts/{accId}/" + WebResourceRegistry.STACKS + "/-*-", HttpAction.GET);
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.projects.stacks", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.create", group, "projects/-*-/" + WebResourceRegistry.STACKS, HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.show", group, "projects/-*-/" + WebResourceRegistry.STACKS + "/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.parameters.show", group, "projects/-*-/" + WebResourceRegistry.STACKS + "/-*-/parameters", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.parameters.modify", group, "projects/-*-/" + WebResourceRegistry.STACKS + "/-*-/parameters", HttpAction.PUT);
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.projects.sessions", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.start", group, "projects/-*-/" + WebResourceRegistry.STACKS + "/-*-/sessions", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.stop", group, "projects/-*-/" + WebResourceRegistry.STACKS + "/-*-/sessions/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.status", group, "projects/-*-/" + WebResourceRegistry.STACKS + "/-*-/sessions/-*-", HttpAction.GET);
// entitlement.groups.sessions
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.sessions", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.start", group, "accounts/{accId}/" + WebResourceRegistry.STACKS + "/-*-/sessions", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.stop", group, "accounts/{accId}/" + WebResourceRegistry.STACKS + "/-*-/sessions/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.status", group, "accounts/{accId}/" + WebResourceRegistry.STACKS + "/-*-/sessions/-*-", HttpAction.GET);
// entitlement.groups.stackBlueprints
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.stackBlueprints", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.public.show", group, WebResourceRegistry.STACK_BLUEPRINTS + "/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.public.create", group, WebResourceRegistry.STACK_BLUEPRINTS + "", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.public.update", group, WebResourceRegistry.STACK_BLUEPRINTS + "/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.public.delete", group, WebResourceRegistry.STACK_BLUEPRINTS + "/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.private.show", group, "accounts/{accId}/" + WebResourceRegistry.STACK_BLUEPRINTS + "/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.private.create", group, "accounts/{accId}/" + WebResourceRegistry.STACK_BLUEPRINTS + "", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.private.update", group, "accounts/{accId}/" + WebResourceRegistry.STACK_BLUEPRINTS + "/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stackBlueprints.private.delete", group, "accounts/{accId}/" + WebResourceRegistry.STACK_BLUEPRINTS + "/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.layerBlueprints.public.show", group, WebResourceRegistry.LAYER_BLUEPRINTS + "/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.layerBlueprints.private.show", group, "accounts/{accId}/" + WebResourceRegistry.LAYER_BLUEPRINTS + "/-*-", HttpAction.GET);
// entitlement.groups.others
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.others", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.images.public.show", group, "images/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.images.public.create", group, "images", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.images.public.delete", group, "images/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.images.private.show", group, "accounts/{accId}/images/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.images.private.create", group, "accounts/{accId}/images", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.images.private.delete", group, "accounts/{accId}/images/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.repositories.public.show", group, "repositories/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.repositories.public.create", group, "repositories", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.repositories.public.delete", group, "repositories/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.repositories.public.show", group, "accounts/{accId}/repositories/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.repositories.public.create", group, "accounts/{accId}/repositories", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.repositories.public.delete", group, "accounts/{accId}/repositories/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.accounts.show", group, "accounts/{accId}", HttpAction.GET);
// manage account users
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.users", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.create", group, "accounts/{accId}/users", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.show", group, "accounts/{accId}/users/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.modify", group, "accounts/{accId}/users/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.delete", group, "accounts/{accId}/users/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.show", group, "accounts/{accId}/users/-*-/entitlements/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.delete", group, "accounts/{accId}/users/-*-/entitlements/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.create", group, "accounts/{accId}/users/-*-/entitlements", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.showGroups", group, "accounts/{accId}/users/-*-/groups", HttpAction.GET);
// manage account groups
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.groups", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.create", group, "accounts/{accId}/groups", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.show", group, "accounts/{accId}/groups/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.delete", group, "accounts/{accId}/groups/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.entitlements.show", group, "accounts/{accId}/groups/-*-/entitlements/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.entitlements.delete", group, "accounts/{accId}/groups/-*-/entitlements/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.entitlements.create", group, "accounts/{accId}/groups/-*-/entitlements", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.showUsers", group, "accounts/{accId}/groups/-*-/users/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.modifyUsers", group, "accounts/{accId}/groups/-*-/users/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.removeUser", group, "accounts/{accId}/groups/-*-/users/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.groups.createUser", group, "accounts/{accId}/groups/-*-/users", HttpAction.POST);
// entitlement.groups.administrators
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.administrators", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.show", group, "users/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.create", group, "users/-*-", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.delete", group, "users/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.modify", group, "users/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.show", group, "users/-*-/entitlements/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.create", group, "users/-*-/entitlements", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.users.entitlements.delete", group, "users/-*-/entitlements/-*-", HttpAction.DELETE);
// entitlement.groups.stacks.all
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.stacks.all", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.show", group, WebResourceRegistry.STACKS, HttpAction.GET);
// entitlement.groups.projects
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.projects", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.show", group, "accounts/{accId}/projects/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.create", group, "accounts/{accId}/projects/-*-", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.delete", group, "accounts/{accId}/projects/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.showMine", group, "accounts/{accId}/users/{userId}/projects/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.showUsers", group, "accounts/{accId}/projects/-*-/users/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.createUser", group, "accounts/{accId}/projects/-*-/users/-*-", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.assignUser", group, "accounts/{accId}/projects/-*-/users/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.removeUser", group, "accounts/{accId}/projects/-*-/users/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.listStacks", group, "accounts/{accId}/projects/-*-/" + WebResourceRegistry.STACKS + "/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.createStacks", group, "accounts/{accId}/projects/-*-/" + WebResourceRegistry.STACKS, HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.deleteStacks", group, "accounts/{accId}/projects/-*-/" + WebResourceRegistry.STACKS + "/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.stacks.deployApplication", group, "accounts/{accId}/projects/-*-/" + WebResourceRegistry.STACKS + "/-*-/application-deployments", HttpAction.POST);
//entitlements for platform admin
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.show", group, "accounts/-*-/projects/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.create", group, "accounts/-*-/projects/-*-", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.delete", group, "accounts/-*-/projects/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.showUsers", group, "accounts/-*-/projects/-*-/users/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.createUser", group, "accounts/-*-/projects/-*-/users/-*-", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.assignUser", group, "accounts/-*-/projects/-*-/users/-*-", HttpAction.PUT);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.removeUser", group, "accounts/-*-/projects/-*-/users/-*-", HttpAction.DELETE);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.listStacks", group, "accounts/-*-/projects/-*-/" + WebResourceRegistry.STACKS + "/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.projects.createStacks", group, "accounts/-*-/projects/-*-/" + WebResourceRegistry.STACKS, HttpAction.POST);
// entitlements for keystone access management
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.keystone", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.credentials.getMine", group, "accounts/{accId}/users/{userId}/os-credentials", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.credentials.get", group, "accounts/-*-/users/-*-/os-credentials", HttpAction.GET);
group = new CompositeEntitlementDictionary(++lastId, "entitlement.groups.keypairs", mainDict);
new ExplicitEntitlementDictionary(++lastId, "entitlements.keypairs.create", group, "accounts/{accId}/users/{userId}/os-keypairs", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.keypairs.generate", group, "accounts/{accId}/users/{userId}/os-keypairs/-*-", HttpAction.POST);
new ExplicitEntitlementDictionary(++lastId, "entitlements.keypairs.list", group, "accounts/{accId}/users/{userId}/os-keypairs", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.keypairs.show", group, "accounts/{accId}/users/{userId}/os-keypairs/-*-", HttpAction.GET);
new ExplicitEntitlementDictionary(++lastId, "entitlements.keypairs.delete", group, "accounts/{accId}/users/{userId}/os-keypairs/-*-", HttpAction.DELETE);
}
/** {@inheritDoc} */
@Override
public EntitlementDictionary getMainEntitlementDictionary() {
return mainDict;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy