public synchronized void addScopedRole(ScopedRole toAdd) { for (ScopedRoleListener listener : scopedRoleListeners) { listener.scopedRoleAdded(toAdd); } Map<String, ScopedRole> newScopedRoles = new HashMap<String, ScopedRole>(roleMaps.scopedRoles); newScopedRoles.put(toAdd.getName(), toAdd); roleMaps = new RoleMaps(roleMaps.standardRoles, newScopedRoles); }
public synchronized void addScopedRole(ScopedRole toAdd) { for (ScopedRoleListener listener : scopedRoleListeners) { listener.scopedRoleAdded(toAdd); } Map<String, ScopedRole> newScopedRoles = new HashMap<String, ScopedRole>(roleMaps.scopedRoles); newScopedRoles.put(toAdd.getName(), toAdd); roleMaps = new RoleMaps(roleMaps.standardRoles, newScopedRoles); }
public synchronized void addScopedRole(ScopedRole toAdd) { for (ScopedRoleListener listener : scopedRoleListeners) { listener.scopedRoleAdded(toAdd); } Map<String, ScopedRole> newScopedRoles = new HashMap<String, ScopedRole>(roleMaps.scopedRoles); newScopedRoles.put(toAdd.getName(), toAdd); roleMaps = new RoleMaps(roleMaps.standardRoles, newScopedRoles); }
@Override public synchronized void scopedRoleRemoved(AuthorizerConfiguration.ScopedRole removed) { String officialForm = getOfficialForm(removed.getName()); StandardRole standard; try { standard = StandardRole.valueOf(officialForm); } catch (RuntimeException ignored) { // wasn't a standard role standard = null; } if (standard != null) { throw ControllerMessages.MESSAGES.cannotRemoveStandardRole(standard.toString()); } synchronized (this) { scopedBaseMap.remove(officialForm); rolePermissionsConfigured = false; } }
@Override public synchronized void scopedRoleAdded(AuthorizerConfiguration.ScopedRole added) { String roleName = added.getName(); String officialForm = getOfficialForm(roleName); if (permissionsByRole.containsKey(officialForm)) { throw ControllerMessages.MESSAGES.roleIsAlreadyRegistered(roleName); } String baseName = added.getBaseRoleName(); String officialBase = getOfficialForm(baseName); if (rolePermissionsConfigured && !permissionsByRole.containsKey(officialBase)) { throw ControllerMessages.MESSAGES.unknownBaseRole(baseName); } ScopingConstraint constraint = added.getScopingConstraint(); addConstraintFactory(constraint.getFactory()); scopedBaseMap.put(officialForm, new ScopedBase(StandardRole.valueOf(officialBase), constraint)); rolePermissionsConfigured = false; }
@Override public synchronized void scopedRoleRemoved(AuthorizerConfiguration.ScopedRole removed) { String officialForm = getOfficialForm(removed.getName()); StandardRole standard; try { standard = StandardRole.valueOf(officialForm); } catch (RuntimeException ignored) { // wasn't a standard role standard = null; } if (standard != null) { throw ControllerLogger.ROOT_LOGGER.cannotRemoveStandardRole(standard.toString()); } synchronized (this) { scopedBaseMap.remove(officialForm); rolePermissionsConfigured = false; } }
@Override public synchronized void scopedRoleRemoved(AuthorizerConfiguration.ScopedRole removed) { String officialForm = getOfficialForm(removed.getName()); StandardRole standard; try { standard = StandardRole.valueOf(officialForm); } catch (RuntimeException ignored) { // wasn't a standard role standard = null; } if (standard != null) { throw ControllerLogger.ROOT_LOGGER.cannotRemoveStandardRole(standard.toString()); } synchronized (this) { scopedBaseMap.remove(officialForm); rolePermissionsConfigured = false; } }
@Override public synchronized void scopedRoleAdded(AuthorizerConfiguration.ScopedRole added) { String roleName = added.getName(); String officialForm = getOfficialForm(roleName); if (permissionsByRole.containsKey(officialForm)) { throw ControllerLogger.ROOT_LOGGER.roleIsAlreadyRegistered(roleName); } String baseName = added.getBaseRoleName(); String officialBase = getOfficialForm(baseName); if (rolePermissionsConfigured && !permissionsByRole.containsKey(officialBase)) { throw ControllerLogger.ROOT_LOGGER.unknownBaseRole(baseName); } ScopingConstraint constraint = added.getScopingConstraint(); addConstraintFactory(constraint.getFactory()); scopedBaseMap.put(officialForm, new ScopedBase(StandardRole.valueOf(officialBase), constraint)); rolePermissionsConfigured = false; }
@Override public synchronized void scopedRoleAdded(AuthorizerConfiguration.ScopedRole added) { String roleName = added.getName(); String officialForm = getOfficialForm(roleName); if (permissionsByRole.containsKey(officialForm)) { throw ControllerLogger.ROOT_LOGGER.roleIsAlreadyRegistered(roleName); } String baseName = added.getBaseRoleName(); String officialBase = getOfficialForm(baseName); if (rolePermissionsConfigured && !permissionsByRole.containsKey(officialBase)) { throw ControllerLogger.ROOT_LOGGER.unknownBaseRole(baseName); } ScopingConstraint constraint = added.getScopingConstraint(); addConstraintFactory(constraint.getFactory()); scopedBaseMap.put(officialForm, new ScopedBase(StandardRole.valueOf(officialBase), constraint)); rolePermissionsConfigured = false; }