public ORole allow ( final ORule . ResourceGeneric resourceGeneric , String resourceSpecific , final int iOperation ) { if ( roles == null || roles . isEmpty ( ) ) { if ( document . field ( "roles" ) != null && ! ( ( Collection < OIdentifiable > ) document . field ( "roles" ) ) . isEmpty ( ) ) { final ODocument doc = document ; document = null ; fromStream ( doc ) ; } else throw new OSecurityAccessException ( document . getDatabase ( ) . getName ( ) , "User '" + document . field ( "name" ) + "' has no role defined" ) ; } final ORole role = checkIfAllowed ( resourceGeneric , resourceSpecific , iOperation ) ; if ( role == null ) throw new OSecurityAccessException ( document . getDatabase ( ) . getName ( ) , "User '" + document . field ( "name" ) + "' does not have permission to execute the operation '" + ORole . permissionToString ( iOperation ) + "' against the resource: " + resourceGeneric + "." + resourceSpecific ) ; return role ; }
Checks if the user has the permission to access to the requested resource for the requested operation .