protected CPrivilege buildPrivilege( String name, String description, String repoId ) { CPrivilege priv = new CPrivilege(); priv.setId( createPrivilegeId( repoId ) ); priv.setName( name ); priv.setDescription( description ); priv.setType( RepositoryViewPrivilegeDescriptor.TYPE ); CProperty prop = new CProperty(); prop.setKey( RepositoryPropertyDescriptor.ID ); prop.setValue( repoId ); priv.addProperty( prop ); return priv; }
public void removePrivilege( final CPrivilege cPrivilege ) { id2privileges.remove( cPrivilege.getId() ); delegate.removePrivilege( cPrivilege ); }
@Override public void doUpgrade( Configuration cfg ) throws ConfigurationIsCorruptedException { for ( CRole role : cfg.getRoles() ) { updateDeprecatedRoles( role.getRoles() ); } for ( CUserRoleMapping map : cfg.getUserRoleMappings() ) { updateDeprecatedRoles( map.getRoles() ); } }
public String getPrivilegeProperty( CPrivilege privilege, String key ) { if ( privilege != null && privilege.getProperties() != null ) { for ( CProperty prop : privilege.getProperties() ) { if ( prop.getKey().equals( key ) ) { return prop.getValue(); } } } return null; }
public void addPrivilege( final CPrivilege cPrivilege ) { final CPrivilege cp = cPrivilege.clone(); delegate.addPrivilege( cp ); id2privileges.put( cp.getId(), cp ); }
protected void rebuildId2RoleMappingsLookupMap() { id2roleMappings.clear(); for ( CUserRoleMapping user2role : delegate.getUserRoleMappings() ) { id2roleMappings.put( getUserRoleMappingKey( user2role.getUserId(), user2role.getSource() ), user2role ); } }
protected void rebuildId2PrivilegesLookupMap() { id2privileges.clear(); for ( CPrivilege privilege : delegate.getPrivileges() ) { id2privileges.put( privilege.getId(), privilege ); } }
public void addUserRoleMapping( final CUserRoleMapping cUserRoleMapping ) { final CUserRoleMapping curm = cUserRoleMapping.clone(); delegate.addUserRoleMapping( curm ); id2roleMappings.put( getUserRoleMappingKey( curm.getUserId(), curm.getSource() ), curm ); }
public void removeUserRoleMapping( final CUserRoleMapping cUserRoleMapping ) { id2roleMappings.remove( getUserRoleMappingKey( cUserRoleMapping.getUserId(), cUserRoleMapping.getSource() ) ); delegate.removeUserRoleMapping( cUserRoleMapping ); }
public void removeUser( final CUser cUser ) { id2users.remove( cUser.getId() ); delegate.removeUser( cUser ); }
public List<CRole> getRoles() { // we are intentionally breaking code that will try to _modify_ the list // as the old config manager was before we fixed it return ImmutableList.copyOf( delegate.getRoles() ); }
public List<CUser> getUsers() { // we are intentionally breaking code that will try to _modify_ the list // as the old config manager was before we fixed it return ImmutableList.copyOf( delegate.getUsers() ); }
public void removeRole( final CRole cRole ) { id2roles.remove( cRole.getId() ); delegate.removeRole( cRole ); }
private CRole getRole(String id, List<CRole> roles) { for (CRole role : roles) { if (role.getId().equals(id)) { return role; } } return null; }
private boolean isLegacyUser(CUser user) { //Legacy users have a shorter, unsalted, SHA1 or MD5 based hash return user.getPassword().length() <= this.MAX_LEGACY_PASSWORD_LENGTH; }
public void setUsers( final List<CUser> users ) { delegate.setUsers( users ); rebuildId2UsersLookupMap(); }