org.wso2.carbon.registry.core.ActionConstants Java Examples
The following examples show how to use
org.wso2.carbon.registry.core.ActionConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonUtil.java From carbon-commons with Apache License 2.0 | 6 votes |
public static void setAnonAuthorization(String path, UserRealm userRealm) throws RegistryException { if (userRealm == null) { return; } try { AuthorizationManager accessControlAdmin = userRealm.getAuthorizationManager(); String everyoneRole = CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME; accessControlAdmin.authorizeRole(everyoneRole, path, ActionConstants.GET); accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.PUT); accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.DELETE); accessControlAdmin.denyRole(everyoneRole, path, AccessControlConstants.AUTHORIZE); } catch (UserStoreException e) { String msg = "Could not set authorizations for the " + path + "."; log.error(msg, e); throw new RegistryException(msg); } }
Example #2
Source File: CommonUtil.java From attic-stratos with Apache License 2.0 | 6 votes |
public static void setAnonAuthorization(String path, UserRealm userRealm) throws RegistryException { if (userRealm == null) { return; } try { AuthorizationManager accessControlAdmin = userRealm.getAuthorizationManager(); String everyoneRole = CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME; accessControlAdmin.authorizeRole(everyoneRole, path, ActionConstants.GET); accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.PUT); accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.DELETE); accessControlAdmin.denyRole(everyoneRole, path, AccessControlConstants.AUTHORIZE); } catch (UserStoreException e) { String msg = "Could not set authorizations for the " + path + "."; log.error(msg, e); throw new RegistryException(msg); } }
Example #3
Source File: APIManagerComponent.java From carbon-apimgt with Apache License 2.0 | 5 votes |
private void setupImagePermissions() throws APIManagementException { try { AuthorizationManager accessControlAdmin = ServiceReferenceHolder.getInstance().getRealmService().getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID).getAuthorizationManager(); String imageLocation = APIUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + APIConstants.API_IMAGE_LOCATION; if (!accessControlAdmin.isRoleAuthorized(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, imageLocation, ActionConstants.GET)) { // Can we get rid of this? accessControlAdmin.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, imageLocation, ActionConstants.GET); } } catch (UserStoreException e) { throw new APIManagementException("Error while setting up permissions for image collection", e); } }