Traverses the permission tree, returning the permission at given permission path.
12617
def _traverse_tree(tree, path):
        """"""
        path_steps = (step for step in path.split('.') if step != '')
        # Special handling for first step, because the first step isn't under 'objects'
        first_step = path_steps.next()
        subtree = tree[first_step]

        for step in path_steps:
            subtree = subtree['children'][step]
        return subtree
1231226
public void addPermission(String path) {
        if (path == null) {
            return;
        }

        if (securityManager != null) {
            Permission permission = null;
            if( path.startsWith("jndi:") || path.startsWith("jar:jndi:") ) {
                if (!path.endsWith("/")) {
                    path = path + "/";
                }
                permission = new JndiPermission(path + "*");
                addPermission(permission);
            } else {
                if (!path.endsWith(File.separator)) {
                    permission = new FilePermission(path, "read");
                    addPermission(permission);
                    path = path + File.separator;
                }
                permission = new FilePermission(path + "-", "read");
                addPermission(permission);
            }
        }
    }
774269
def permission_required(perm, login_url=None):
    

    return user_passes_test(lambda u: u.has_perm(perm), login_url=login_url)
893023
def get_permissions(self):
        
        path = Client.urls['all_permissions']
        conns = self._call(path, 'GET')
        return conns
157074
public synchronized Permission find(String name) {
        for (Permission p : permissions) {
            if(p.name.equals(name))
                return p;
        }
        return null;
    }
415653
def check_permission(*permissions, **args_map):
    
    def f1(func, permissions=permissions):
        @wraps(func)
        def f2(*args, **kwargs):
            from uliweb import request, error

            arguments = {}
            for k, v in args_map.items():
                if v in kwargs:
                    arguments[k] = kwargs[v]
            if not has_permission(request.user, *permissions, **arguments):
                error(_("You have no permissions to visit this page."))
            return func(*args, **kwargs)
        return f2
    return f1
39111
private FSPermissionChecker checkPermission(String path, INode[] inodes, boolean doCheckOwner,
                                              FsAction ancestorAccess, FsAction parentAccess, FsAction access,
                                              FsAction subAccess)
    throws AccessControlException {
    boolean permissionCheckFailed = false;
    FSPermissionChecker pc = new FSPermissionChecker(
      fsOwner.getUserName(), supergroup, this.getCurrentUGI());
    if (!pc.isSuper) {
      dir.waitForReady();
      readLock();
      try {
        pc.checkPermission(path, inodes, doCheckOwner,
          ancestorAccess, parentAccess, access, subAccess);
      } catch (AccessControlException e) {
        if (!this.permissionAuditOnly) {
          throw e;
        }
        permissionCheckFailed = true;
      } finally {
        readUnlock();
      }
    }
    if (permissionCheckFailed) {
      // do not throw the exception, we would like to only log.
      LOG.warn("PermissionAudit failed on " + path +
        " checkOwner:" + doCheckOwner +
        " ancestor:" + ancestorAccess +
        " parent:" + parentAccess +
        " access:" + access +
        " subaccess:" + subAccess);
    }
    return pc;
  }
528608
def has_read_permission(self, request, path):
        
        user = request.user
        if not user.is_authenticated():
            return False
        elif user.is_superuser:
            return True
        elif user.is_staff:
            return True
        else:
            return False
188486
def find_permission(self, name):
        
        return (
            self.get_session.query(self.permission_model).filter_by(name=name).first()
        )
1181835
public java.lang.String getPermission() {
    java.lang.Object ref = permission_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      permission_ = s;
      return s;
    }
  }
338558
public void chmod(String path, int permissions) throws IOException {
        SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
        atts.permissions = permissions;
        setstat(path, atts);
    }
483398
def get(self, permission_id, expand=[]):
        
        parent_url = self.client.get_url(self.parent_object._manager._URL_KEY, 'GET', 'single', {'id': self.parent_object.id})
        target_url = parent_url + self.client.get_url_path(
            self._URL_KEY, 'GET', 'single', {'permission_id': permission_id})
        return self._get(target_url, expand=expand)
828195
def chmod(cls, path, permission_text):
        

        try:
            check_file_existence(path)
        except FileNotFoundError:
            _, e, _ = sys.exc_info()  # for python 2.5 compatibility
            logger.debug(e)
            return False

        logger.debug("chmod %s %s" % (path, permission_text))

        os.chmod(path, parseLsPermissionText(permission_text))
269746
@Override
    protected void handlePermission(@NonNull File path) {
//         Should we show an explanation?
//        if (shouldShowRequestPermissionRationale(
//                Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
//             Explain to the user why we need permission
//        }

        mRequestedPath = path;
        requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
    }
1005011
def get_permissions(self):
        '''
        
        '''
        response = self.client.getHelper(self.url, acl='true')
        if response.status_code != 200:
            raise DataApiError('Unable to get permissions:' + str(response.content))
        content = response.json()
        if 'acl' in content:
            return Acl.from_acl_response(content['acl'])
        else:
            return None
981234
public static String permissions(Path path) {
        try {
            return permissions(getUnixMode(path));
        } catch (IOException e) {
            throw Exceptions.propagate(e);
        }
    }
557192
public static void getPermission(@NonNull Activity context, String permissions, @NonNull Response response) {
        getPermission(context, new String[]{permissions}, response);
    }