protected void cleanupPrivileges( String propertyId, String propertyValue ) throws NoSuchPrivilegeException, NoSuchAuthorizationManagerException { Set<Privilege> privileges = security.listPrivileges(); Set<String> removedIds = new HashSet<String>(); for ( Privilege privilege : privileges ) { if ( !privilege.isReadOnly() && privilege.getType().equals( TargetPrivilegeDescriptor.TYPE ) && ( propertyValue.equals( privilege.getPrivilegeProperty( propertyId ) ) ) ) { getLogger().debug( "Removing Privilege " + privilege.getName() + " because repository was removed" ); security.getAuthorizationManager( SecurityXmlAuthorizationManager.SOURCE ).deletePrivilege( privilege.getId() ); removedIds.add( privilege.getId() ); } } for ( String privilegeId : removedIds ) { configManager.cleanRemovedPrivilege( privilegeId ); } configManager.save(); } }
if (priv.getType().equals(ApplicationPrivilegeDescriptor.TYPE)) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Cannot delete an application type privilege");
if ( priv.getType().equals( ApplicationPrivilegeDescriptor.TYPE ) )
if (priv.getType().equals("method")) { String permission = priv.getPrivilegeProperty("permission"); privilegeMap.put(permission, NONE);
protected CPrivilege toPrivilege( Privilege privilege ) { CPrivilege secPriv = new CPrivilege(); secPriv.setId( privilege.getId() ); secPriv.setName( privilege.getName() ); secPriv.setDescription( privilege.getDescription() ); secPriv.setReadOnly( privilege.isReadOnly() ); secPriv.setType( privilege.getType() ); if ( privilege.getProperties() != null && privilege.getProperties().entrySet() != null ) { for ( Entry<String, String> entry : privilege.getProperties().entrySet() ) { CProperty prop = new CProperty(); prop.setKey( entry.getKey() ); prop.setValue( entry.getValue() ); secPriv.addProperty( prop ); } } return secPriv; }
public PrivilegeStatusResource securityToRestModel(Privilege privilege, Request request, boolean appendResourceId) { PrivilegeStatusResource resource = new PrivilegeStatusResource(); for (Entry<String, String> prop : privilege.getProperties().entrySet()) { PrivilegeProperty privProp = new PrivilegeProperty(); privProp.setKey(prop.getKey()); privProp.setValue(prop.getValue()); resource.addProperty(privProp); } resource.setType(privilege.getType()); resource.setId(privilege.getId()); resource.setName(privilege.getName()); resource.setDescription(privilege.getDescription()); String resourceId = ""; if (appendResourceId) { resourceId = resource.getId(); } resource.setResourceURI(this.createChildReference(request, resourceId).toString()); resource.setUserManaged(!privilege.isReadOnly()); return resource; }
public PrivilegeStatusResource securityToRestModel( Privilege privilege, Request request, boolean appendResourceId ) { PrivilegeStatusResource resource = new PrivilegeStatusResource(); for ( Entry<String, String> prop : privilege.getProperties().entrySet() ) { PrivilegeProperty privProp = new PrivilegeProperty(); privProp.setKey( prop.getKey() ); privProp.setValue( prop.getValue() ); resource.addProperty( privProp ); } resource.setType( privilege.getType() ); resource.setId( privilege.getId() ); resource.setName( privilege.getName() ); resource.setDescription( privilege.getDescription() ); String resourceId = ""; if ( appendResourceId ) { resourceId = resource.getId(); } resource.setResourceURI( this.createChildReference( request, resourceId ).toString() ); resource.setUserManaged( !privilege.isReadOnly() ); return resource; }
if ( priv.getType().equals( "method" ) )