use of org.ow2.proactive.permissions.MethodCallPermission in project scheduling by ow2-proactive.
the class SchedulerFrontendState method checkPermissionReturningListeningUser.
synchronized ListeningUser checkPermissionReturningListeningUser(String methodName, String permissionMsg) throws NotConnectedException, PermissionException {
UniqueID id = checkAccess();
ListeningUser ident = identifications.get(id);
// renew session for this user
renewUserSession(id, ident.getUser());
final String fullMethodName = SchedulerFrontend.class.getName() + "." + methodName;
final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);
try {
ident.getUser().checkPermission(methodCallPermission, permissionMsg);
} catch (PermissionException ex) {
logger.warn(permissionMsg);
throw ex;
}
return ident;
}
use of org.ow2.proactive.permissions.MethodCallPermission in project scheduling by ow2-proactive.
the class RMCore method checkMethodCallPermission.
/**
* Checks if the caller thread has permissions to call particular method name
*
* @return client object corresponding to the caller thread
*/
private Client checkMethodCallPermission(final String methodName, UniqueID clientId) {
Client client = RMCore.clients.get(clientId);
if (client == null) {
// Check if the client id is a local body or half body
LocalBodyStore lbs = LocalBodyStore.getInstance();
if (lbs.getLocalBody(clientId) != null || lbs.getLocalHalfBody(clientId) != null) {
return RMCore.localClient;
}
throw new NotConnectedException("Client " + clientId.shortString() + " is not connected to the resource manager");
}
final String fullMethodName = RMCore.class.getName() + "." + methodName;
final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);
client.checkPermission(methodCallPermission, client + " is not authorized to call " + fullMethodName);
return client;
}
Aggregations