public Role getRole(String roleId) throws NoSuchRoleException { for (Role role : this.listRoles()) { if (role.getRoleId().equals(roleId)) { return role; } } throw new NoSuchRoleException("Role '" + roleId + "' not found."); }
public Role getRole( String roleId ) throws NoSuchRoleException { for ( Role role : this.listRoles() ) { if ( role.getRoleId().equals( roleId ) ) { return role; } } throw new NoSuchRoleException( "Role '" + roleId + "' not found." ); }
public CRole readRole( String id ) throws NoSuchRoleException { CRole role = getConfiguration().getRoleById( id ); if ( role != null ) { return role; } else { throw new NoSuchRoleException( id ); } }
@Override public Role getRole(String roleId) throws NoSuchRoleException { try { String roleName = this.ldapManager.getGroupName(roleId); if (roleName == null) { throw new NoSuchRoleException("Role: " + roleId + " was not found in LDAP."); } Role role = new Role(); role.setName(roleId); role.setRoleId(roleId); role.setSource(this.getSource()); return role; } catch (LdapDAOException e) { throw new NoSuchRoleException("Role: " + roleId + " was not found in LDAP.", e); } catch (NoSuchLdapGroupException e) { throw new NoSuchRoleException("Role: " + roleId + " was not found in LDAP.", e); } }
public Role getRole( String roleId ) throws NoSuchRoleException { try { String roleName = this.ldapManager.getGroupName( roleId ); if ( roleName == null ) { throw new NoSuchRoleException( "Role: " + roleId + " was not found in LDAP." ); } Role role = new Role(); role.setName( roleId ); role.setRoleId( roleId ); role.setSource( this.getSource() ); return role; } catch ( LdapDAOException e ) { throw new NoSuchRoleException( "Role: " + roleId + " was not found in LDAP.", e ); } catch ( NoSuchLdapGroupException e ) { throw new NoSuchRoleException( "Role: " + roleId + " was not found in LDAP.", e ); } }
protected void deleteRole( String id, boolean clean ) throws NoSuchRoleException { boolean found = getConfiguration().removeRoleById( id ); if ( !found ) { throw new NoSuchRoleException( id ); } if ( clean ) { cleanRemovedRole( id ); } }
public Role getRole( String roleId ) throws NoSuchRoleException { if ( this.getPlexusRoleLocator() == null ) { this.logger.warn( "LegacyAuthorizationManager is not configured, it should be removed." ); throw new NoSuchRoleException( "LegacyAuthorizationManager is not configured, it should be removed." ); } for ( PlexusRole plexusRole : this.getPlexusRoleLocator().listRoles() ) { return this.toRole( plexusRole ); } throw new NoSuchRoleException( "Failed to find role :" + roleId + " from legacy PlexusRoleLocator: " + this.getPlexusRoleLocator().getSource() ); }