public boolean isAuthorized ( ChargingStationId chargingStationId , UserIdentity userIdentity , Class commandClass ) { // first search for this specific authorization boolean isAuthorized = commandAuthorizationRepository . find ( chargingStationId . getId ( ) , userIdentity . getId ( ) , commandClass ) != null ; if ( ! isAuthorized ) { // maybe the user identity has access to 'allPermissions' isAuthorized = commandAuthorizationRepository . find ( chargingStationId . getId ( ) , userIdentity . getId ( ) , AllPermissions . class ) != null ; } return isAuthorized ; }
Checks if a user identity has access to a command class for a certain charging station .