Search in sources :

Example 1 with PrivilegedEntity

use of org.apache.hadoop.yarn.security.PrivilegedEntity 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());
}
Also used : ArrayList(java.util.ArrayList) Permission(org.apache.hadoop.yarn.security.Permission) PrivilegedEntity(org.apache.hadoop.yarn.security.PrivilegedEntity) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with PrivilegedEntity

use of org.apache.hadoop.yarn.security.PrivilegedEntity 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;
}
Also used : AccessControlList(org.apache.hadoop.security.authorize.AccessControlList) HashMap(java.util.HashMap) QueueACL(org.apache.hadoop.yarn.api.records.QueueACL) Permission(org.apache.hadoop.yarn.security.Permission) PrivilegedEntity(org.apache.hadoop.yarn.security.PrivilegedEntity) AccessType(org.apache.hadoop.yarn.security.AccessType)

Aggregations

Permission (org.apache.hadoop.yarn.security.Permission)2 PrivilegedEntity (org.apache.hadoop.yarn.security.PrivilegedEntity)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AccessControlList (org.apache.hadoop.security.authorize.AccessControlList)1 QueueACL (org.apache.hadoop.yarn.api.records.QueueACL)1 AccessType (org.apache.hadoop.yarn.security.AccessType)1