Legacy acl format kept for bw. compatibility
    :param permissions:
    :return:
516109
def permission_to_04_acls(permissions):
    
    acls = []
    for perm in permissions:
        if perm.type == "user":
            acls.append((perm.user.id, perm.perm_name))
        elif perm.type == "group":
            acls.append(("group:%s" % perm.group.id, perm.perm_name))
    return acls
420716
def meth_acl(args):
    ''' '''
    r = fapi.get_repository_method_acl(args.namespace, args.method,
                                                    args.snapshot_id)
    fapi._check_response_code(r, 200)
    acls = sorted(r.json(), key=lambda k: k['user'])
    return map(lambda acl: '{0}\t{1}'.format(acl['user'], acl['role']), acls)
644023
def trusted_permission(f):
    """"""

    @functools.wraps(f)
    def wrapper(request, *args, **kwargs):
        trusted(request)
        return f(request, *args, **kwargs)

    return wrapper
516657
def _get_all_permissions(opts):
    ""
    perms = []
    for action in settings.DEFAULT_PERMISSIONS:
        perms.append((_get_permission_codename(action, opts), 'Can %s %s' % (action, opts.verbose_name_raw)))
    return perms + list(opts.permissions)
1272810
def fix_permissions (self):
        """"""
        if os.name == 'posix' and not self.dry_run:
            # Make the data files we just installed world-readable,
            # and the directories world-executable as well.
            for path in self.get_outputs():
                mode = os.stat(path)[stat.ST_MODE]
                if stat.S_ISDIR(mode):
                    mode |= 0o11
                mode |= 0o44
                os.chmod(path, mode)
275462
private static List<String> getDeniedPermissions(PermissionChecker checker, Source source, String... permissions) {
        List<String> deniedList = new ArrayList<>(1);
        for (String permission : permissions) {
            if (!checker.hasPermission(source.getContext(), permission)) {
                deniedList.add(permission);
            }
        }
        return deniedList;
    }
784584
def set_collections_acl(self):
        
        acl = [(Allow, 'g:admin', ALL_PERMISSIONS)]
        collections = self.get_collections()
        resources = self.get_resources(collections)
        aces = self._get_least_permissions_aces(resources)
        if aces is not None:
            for ace in aces:
                acl.append(ace)
        acl.append(DENY_ALL)
        self.__acl__ = tuple(acl)
74452
def ensure_permissions(mode_flags=stat.S_IWUSR):
    

    def decorator(f):
        def modify(filename, *args, **kwargs):
            m = chmod_perms(filename) if exists(filename) else mode_flags
            if not m & mode_flags:
                os.chmod(filename, m | mode_flags)
            try:
                return f(filename, *args, **kwargs)
            finally:
                # restore original permissions
                if not m & mode_flags:
                    os.chmod(filename, m)
        return modify

    return decorator
603425
def http_basic_auth_permissions_required(permissions):
    """"""

    if isinstance(permissions, six.string_types):
        return auth.set_authentication_predicate(http_basic_auth_check_user, [auth.user_has_perm, permissions])
    else:
        return auth.set_authentication_predicate(http_basic_auth_check_user, [auth.user_has_all_perms, permissions])
940619
public static boolean isAllowed(ODocument doc, OrientPermission... permissions)
	{
		if(!isAllowed(doc.getSchemaClass(), permissions)) return false;
		for (OrientPermission orientPermission : permissions) {
			ORestrictedOperation allowOperation = MAPPING_FOR_HACK.get(orientPermission);
			if(allowOperation!=null)
			{
				if(!AccessToIsAllowedInRestrictedAccessHook.INSTANCE.isAllowed(doc, allowOperation, false)) return false;
			}
		}
		return true;
	}
256032
def has(*permissions, **kwargs):
    

    target = kwargs['target']

    kwargs['target'] = type_for(target)

    # TODO: Predicate evaluation?
    return target in filter_(*permissions, **kwargs)
802882
def permissions(self, course_id, permissions=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - course_id
        """ID"""
        path["course_id"] = course_id

        # OPTIONAL - permissions
        """List of permissions to check against authenticated user"""
        if permissions is not None:
            params["permissions"] = permissions

        self.logger.debug("GET /api/v1/courses/{course_id}/permissions with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("GET", "/api/v1/courses/{course_id}/permissions".format(**path), data=data, params=params, no_data=True)
597231
def permissions(self, addr, permissions=None):
        

        if self.state.solver.symbolic(addr):
            raise SimMemoryError(
                "page permissions cannot currently be looked up for symbolic addresses")

        if isinstance(addr, claripy.ast.bv.BV):
            addr = self.state.solver.eval(addr)

        page_num = addr // self._page_size

        try:
            page = self._get_page(page_num)
        except KeyError:
            raise SimMemoryError("page does not exist at given address")

        # Set permissions for the page
        if permissions is not None:
            if isinstance(permissions, (int, long)):
                permissions = claripy.BVV(permissions, 3)

            if not isinstance(permissions, claripy.ast.bv.BV):
                raise SimMemoryError(
                    "Unknown permissions argument type of {0}.".format(
                        type(permissions)))

            page.permissions = permissions

        return page.permissions
926005
def allow_rwe(self, name):
        """"""
        assert name in PERMISSIONS.keys()
        os.chmod(self.file_path, PERMISSIONS[name]['all'])
361260
public String permissionsToYml(Collection<Permission> permissions) {
        try {
            Map<String, Map<String, Set<Permission>>> map = new TreeMap<>();
            permissions.forEach(permission -> {
                map.putIfAbsent(permission.getMsName(), new TreeMap<>());
                map.get(permission.getMsName()).putIfAbsent(permission.getRoleKey(), new TreeSet<>());
                map.get(permission.getMsName()).get(permission.getRoleKey()).add(permission);
            });
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            log.error("Failed to create permissions YML file from collection, error: {}", e.getMessage(), e);
        }
        return null;
    }
759181
private static List<String> getRationalePermissions(Source source, String... permissions) {
        List<String> rationaleList = new ArrayList<>(1);
        for (String permission : permissions) {
            if (source.isShowRationalePermission(permission)) {
                rationaleList.add(permission);
            }
        }
        return rationaleList;
    }
501970
def permissions
      permissions_list = {
        can: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } },
        cannot: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } }
      }
      rules.each { |rule| extract_rule_in_permissions(permissions_list, rule) }
      permissions_list
    end