public boolean isAuthorized ( final String username , final String resource ) { if ( username == null || resource == null ) return false ; try { if ( getServer ( ) != null ) { OUser user = getServer ( ) . getSecurity ( ) . getSystemUser ( username , null ) ; if ( user != null && user . getAccountStatus ( ) == OSecurityUser . STATUSES . ACTIVE ) { ORole role = null ; ORule . ResourceGeneric rg = ORule . mapLegacyResourceToGenericResource ( resource ) ; if ( rg != null ) { String specificResource = ORule . mapLegacyResourceToSpecificResource ( resource ) ; if ( specificResource == null || specificResource . equals ( "*" ) ) { specificResource = null ; } role = user . checkIfAllowed ( rg , specificResource , ORole . PERMISSION_EXECUTE ) ; } return role != null ; } } } catch ( Exception ex ) { OLogManager . instance ( ) . error ( this , "isAuthorized()" , ex ) ; } return false ; }
Checks to see if a