/** * Shows application visibility to the user * @param appPath Path of the application * @param username Username of the user * @param opType Op type (ALLOW OR DENY) * @return whether it is success */ public boolean showAppVisibilityToUser(String appPath, String username, String opType){ String userRole = "Internal/private_" + username; try { if("ALLOW".equalsIgnoreCase(opType)) { org.wso2.carbon.user.api.UserRealm realm = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm(); realm.getAuthorizationManager().authorizeRole(userRole, appPath, ActionConstants.GET); return true; }else if("DENY".equalsIgnoreCase(opType)){ org.wso2.carbon.user.api.UserRealm realm = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm(); realm.getAuthorizationManager().denyRole(userRole, appPath, ActionConstants.GET); return true; } return false; } catch (org.wso2.carbon.user.api.UserStoreException e) { log.error("Error while updating visibility of mobile app at " + appPath, e); return false; } } }
AppManagerUtil.getMountedPath(RegistryContext.getBaseInstance(), RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH) + AppMConstants.EXTERNAL_APP_STORES_LOCATION); authManager.denyRole(AppMConstants.EVERYONE_ROLE, resourcePath, ActionConstants.GET);
if (userRealm.getAuthorizationManager().isRoleAuthorized( role, topicResourcePath, EventBrokerConstants.EB_PERMISSION_SUBSCRIBE)) { userRealm.getAuthorizationManager().denyRole( role, topicResourcePath, EventBrokerConstants.EB_PERMISSION_SUBSCRIBE); if (userRealm.getAuthorizationManager().isRoleAuthorized( role, topicResourcePath, EventBrokerConstants.EB_PERMISSION_PUBLISH)) { userRealm.getAuthorizationManager().denyRole( role, topicResourcePath, EventBrokerConstants.EB_PERMISSION_PUBLISH);