Returns (codename, name) for all permissions in the given opts.
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)
1337935
def get_permissions(self, role):
        """"""
        target_role = AuthGroup.objects(role=role, creator=self.client).first()
        if not target_role:
            return '[]'
        targets = AuthPermission.objects(groups=target_role, creator=self.client).only('name')
        return json.loads(targets.to_json())
216970
def get_user_permissions_on_view(view_name):
        
        _ret = list()
        if current_user.is_authenticated:
            _current_user = current_user
        elif current_user_jwt:
            _current_user = current_user_jwt
        else:
            return _ret
        for role in _current_user.roles:
            if role.permissions:
                for permission in role.permissions:
                    if permission.view_menu.name == view_name:
                        _ret.append(permission.permission.name)
        return _ret
961887
def get_requested_aosp_permissions(self):
        
        aosp_permissions = []
        all_permissions = self.get_permissions()
        for perm in all_permissions:
            if perm in list(self.permission_module.keys()):
                aosp_permissions.append(perm)
        return aosp_permissions
830490
def has_any_permissions(self, user):
        
        for perm in self.get_all_model_permissions():
            if self.has_specific_permission(user, perm.codename):
                return True
        return False
441853
def build_permissions(opts = {})
      permission = opts[:permission].to_sym
      clearances = opts[:clearance]
      # To have full read access to the whole APIcasso just set a
      # true key scope operation.
      # Usage:
      # To have full read access to the system the scope would be:
      # => `{read: true}`
      if clearances == true
        can permission, :all
      else
        clearances.to_h.each do |klass, clearance|
          klass_module = klass.underscore.singularize.to_sym
          klass = klass.classify.constantize
          can permission, klass_module
          if clearance == true
            # Usage:
            # To have a key reading all channels and all accouts
            # you would have a scope:
            # => `{read: {channel: true, accout: true}}`
            can permission, klass
          else
            clear_for(permission, klass, clearance)
          end
        end
      end
    end
1130418
def create_permissions_from_tuples(model, codename_tpls):
    
    if codename_tpls:
        model_cls = django_apps.get_model(model)
        content_type = ContentType.objects.get_for_model(model_cls)
        for codename_tpl in codename_tpls:
            app_label, codename, name = get_from_codename_tuple(
                codename_tpl, model_cls._meta.app_label
            )
            try:
                Permission.objects.get(codename=codename, content_type=content_type)
            except ObjectDoesNotExist:
                Permission.objects.create(
                    name=name, codename=codename, content_type=content_type
                )
            verify_codename_exists(f"{app_label}.{codename}")
1261723
public ArrayList<Permission> getEffectivePermissions(String codeBase) {
        List<Permission> emptyPermissions = Collections.emptyList();
        return getEffectivePermissions(emptyPermissions, codeBase);
    }
371913
public List<Permission> getUserPermission(String userName) {
        ACL acl = getServiceDirectoryClient().getACL(AuthScheme.DIRECTORY, userName);

        int permissionId = 0;
        if(acl != null){
            permissionId = acl.getPermission();
        }
        return PermissionUtil.id2Permissions(permissionId);
    }
175676
def request_permission(cls, permissions):
        
        app = AndroidApplication.instance()
        f = app.create_future()

        def on_result(perms):
            allowed = True
            for p in permissions:
                allowed = allowed and perms.get(p, False)
            f.set_result(allowed)

        app.request_permissions(permissions).then(on_result)

        return f
74178
def check_role_permissions(role, permissions, current_permissions):
    
    role_permissions = []

    # get all the current permissions, we'll remove these as we verify they should still be granted
    for permission in permissions:
        splits = permission.split(".")
        if len(splits) != 2 and len(splits) != 3:
            sys.stderr.write("  invalid permission %s, ignoring\n" % permission)
            continue

        app = splits[0]
        codenames = []

        if len(splits) == 2:
            codenames.append(splits[1])
        else:
            (object, action) = splits[1:]

            # if this is a wildcard, then query our database for all the permissions that exist on this object
            if action == '*':
                for perm in Permission.objects.filter(codename__startswith="%s_" % object, content_type__app_label=app):
                    codenames.append(perm.codename)
            # otherwise, this is an error, continue
            else:
                sys.stderr.write("  invalid permission %s, ignoring\n" % permission)
                continue

        if len(codenames) == 0:
            continue

        for codename in codenames:
            # the full codename for this permission
            full_codename = "%s.%s" % (app, codename)

            # this marks all the permissions which should remain
            role_permissions.append(full_codename)

            try:
                assign_perm(full_codename, role)
            except ObjectDoesNotExist:
                pass
                # sys.stderr.write("  unknown permission %s, ignoring\n" % permission)

    # remove any that are extra
    for permission in current_permissions:
        if isinstance(permission, str):
            key = permission
        else:
            key = "%s.%s" % (permission.content_type.app_label, permission.codename)

        if key not in role_permissions:
            remove_perm(key, role)
163116
def get_permission_name
      permission = CONFIGS[:lato_core][:superusers_permissions].values.select{|x| x[:value] === self.permission}
      return permission[0][:title] if permission && !permission.empty?
    end
550007
@SuppressWarnings("unchecked")
    public List<Permission> getPermissions() {
        final Query query = pm.newQuery(Permission.class);
        query.setOrdering("name asc");
        return (List<Permission>) query.execute();
    }
1131207
function getOptions(rules, opts) {
	var dir;
	var obj = {
		source: opts.source,
		transform: opts.transform || function (val) {
			return val;
		}
	};

	obj.path = opts.path || [];
	obj.path = Array.isArray(obj.path) ? obj.path : [obj.path];

	if (rules.length && rules[0].position && rules[0].position.source) {
		dir = path.dirname(rules[0].position.source);
	}

	if (dir && obj.path.indexOf(dir) === -1) {
		obj.path.unshift(dir);
	}

	if (!obj.path.length) {
		obj.path.push(process.cwd());
	}

	return obj;
}
791917
def get_permissions(self):
        
        if not self.object_id:
            return []

        url = self.build_url(
            self._endpoints.get('permissions').format(id=self.object_id))

        response = self.con.get(url)
        if not response:
            return None

        data = response.json()

        # Everything received from cloud must be passed as self._cloud_data_key
        return [DriveItemPermission(parent=self, **{self._cloud_data_key: item})
                for item in data.get('value', [])]
268988
def get_permissions(self, obj):
        
        # TODO: Optimize this for bulk running
        filters = {
            'object_pk': obj.id,
            'content_type': ContentType.objects.get_for_model(obj),
            'permission__codename__startswith': 'view',
        }
        return {
            'users': list(
                UserObjectPermission.objects.filter(**filters).distinct('user').values_list('user_id', flat=True)
            ),
            'groups': list(
                GroupObjectPermission.objects.filter(**filters).distinct('group').values_list('group', flat=True)
            ),
            'public': UserObjectPermission.objects.filter(user__username=ANONYMOUS_USER_NAME, **filters).exists(),
        }
460407
def permission_set(self, name, func=None):
        
        if func is None:
            return functools.partial(self.predicate, name)
        self.permission_sets[name] = func
        return func