use of org.apache.hadoop.yarn.security.Permission in project hadoop by apache.
the class FairScheduler method setQueueAcls.
private void setQueueAcls(Map<String, Map<AccessType, AccessControlList>> queueAcls) throws IOException {
authorizer.setPermission(allocsLoader.getDefaultPermissions(), UserGroupInformation.getCurrentUser());
List<Permission> permissions = new ArrayList<>();
for (Entry<String, Map<AccessType, AccessControlList>> queueAcl : queueAcls.entrySet()) {
permissions.add(new Permission(new PrivilegedEntity(EntityType.QUEUE, queueAcl.getKey()), queueAcl.getValue()));
}
authorizer.setPermission(permissions, UserGroupInformation.getCurrentUser());
}
use of org.apache.hadoop.yarn.security.Permission in project hadoop by apache.
the class CapacitySchedulerQueueManager method setQueueAcls.
@VisibleForTesting
public static /**
* Set the acls for the queues.
* @param authorizer the yarnAuthorizationProvider
* @param queues the queues
* @throws IOException if fails to set queue acls
*/
void setQueueAcls(YarnAuthorizationProvider authorizer, AppPriorityACLsManager appPriorityACLManager, Map<String, CSQueue> queues) throws IOException {
List<Permission> permissions = new ArrayList<>();
for (CSQueue queue : queues.values()) {
AbstractCSQueue csQueue = (AbstractCSQueue) queue;
permissions.add(new Permission(csQueue.getPrivilegedEntity(), csQueue.getACLs()));
if (queue instanceof LeafQueue) {
LeafQueue lQueue = (LeafQueue) queue;
// Clear Priority ACLs first since reinitialize also call same.
appPriorityACLManager.clearPriorityACLs(lQueue.getQueueName());
appPriorityACLManager.addPrioirityACLs(lQueue.getPriorityACLs(), lQueue.getQueueName());
}
}
authorizer.setPermission(permissions, UserGroupInformation.getCurrentUser());
}
use of org.apache.hadoop.yarn.security.Permission in project hadoop by apache.
the class AllocationFileLoaderService method getDefaultPermissions.
/**
* Returns the list of default permissions.
* The default permission for the root queue is everybody ("*")
* and the default permission for all other queues is nobody ("").
* The default permission list would be loaded before the permissions
* from allocation file.
* @return default permission list
*/
protected List<Permission> getDefaultPermissions() {
if (defaultPermissions == null) {
defaultPermissions = new ArrayList<>();
Map<AccessType, AccessControlList> acls = new HashMap<>();
for (QueueACL acl : QueueACL.values()) {
acls.put(SchedulerUtils.toAccessType(acl), EVERYBODY_ACL);
}
defaultPermissions.add(new Permission(new PrivilegedEntity(EntityType.QUEUE, ROOT), acls));
}
return defaultPermissions;
}
Aggregations