private static String getRoleFromText(String text) { try { StandardRole standardRole = StandardRole.valueOf(text.toUpperCase(Locale.ENGLISH)); return standardRole.toString(); } catch (Exception e) { return text; } } }
private static String getRoleFromText(String text) { try { StandardRole standardRole = StandardRole.valueOf(text.toUpperCase(Locale.ENGLISH)); return standardRole.toString(); } catch (Exception e) { return text; } } }
private static String getRoleFromText(String text) { try { StandardRole standardRole = StandardRole.valueOf(text.toUpperCase(Locale.ENGLISH)); return standardRole.toString(); } catch (Exception e) { return text; } } }
private String getOfficialRoleForm(String role) { String official = mappedToOfficialForm.get(role); if (official == null) { for (String scoped : configuration.getScopedRoles().keySet()) { if (role.equalsIgnoreCase(scoped)) { official = scoped; break; } } if (official == null) { try { StandardRole std = StandardRole.valueOf(role.toUpperCase(Locale.ENGLISH)); official = std.getFormalName(); } catch (Exception e) { // ignored } } if (official != null) { mappedToOfficialForm.put(role, official); } else { official = role; } } return official; }
private String getOfficialRoleForm(String role) { String official = mappedToOfficialForm.get(role); if (official == null) { for (String scoped : configuration.getScopedRoles().keySet()) { if (role.equalsIgnoreCase(scoped)) { official = scoped; break; } } if (official == null) { try { StandardRole std = StandardRole.valueOf(role.toUpperCase(Locale.ENGLISH)); official = std.getFormalName(); } catch (Exception e) { // ignored } } if (official != null) { mappedToOfficialForm.put(role, official); } else { official = role; } } return official; }
private String getOfficialRoleForm(String role) { String official = mappedToOfficialForm.get(role); if (official == null) { for (String scoped : configuration.getScopedRoles().keySet()) { if (role.equalsIgnoreCase(scoped)) { official = scoped; break; } } if (official == null) { try { StandardRole std = StandardRole.valueOf(role.toUpperCase(Locale.ENGLISH)); official = std.getFormalName(); } catch (Exception e) { // ignored } } if (official != null) { mappedToOfficialForm.put(role, official); } else { official = role; } } return official; }
@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 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 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; }
@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; }