Set the object permissions. If the parent object already has permissions, they will be overwritten.

        :param [] permissions: A group of Permission objects to be set.
968361
def set(self, permissions):
        
        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, 'PUT', 'multi')
        r = self.client.request('PUT', target_url, json=permissions)
        if r.status_code != 201:
            raise exceptions.ServerError("Expected 201 response, got %s: %s" % (r.status_code, target_url))
        return self.list()
1266102
public void setResourcePermissions(Map<String, Map<String, List<String>>> resourcePermissions) {
		this.resourcePermissions = resourcePermissions;
	}
944968
def object_permission_set(self):
        ''''''
        return Or(
            AllowOnlySafeHttpMethod,
            AllowAdmin,
            And(
                AllowPermission('org:admin'),
                ObjAttrTrue(lambda _, u: not u.is_superuser),
                ObjAttrTrue(
                    lambda r, _: r.data.get('admin') is not True)
            ),
            And(
                AllowModify,
                ObjAttrTrue(
                    lambda req, user: user == req.user),
                ObjAttrTrue(
                    lambda r, _: r.data.get('admin') is not True)
            ),
        )
822458
def permissions(self):
        """"""
        perms = set()
        for r in self.roles:
            perms = perms | set(r.permissions)
        return perms
1336158
@Override
	public synchronized void setPermissions(Collection<Permission> aPermissions)
	{
		this.permissions.clear();
		if (aPermissions == null || aPermissions.isEmpty())
			return;

		List<Permission> set =new ArrayList<Permission>(aPermissions);

		this.permissions = set;

	}
69008
def validate_permissions(perms):
    
    if not isinstance(perms, (list, tuple)):
        perms = [perms]
    valid_perms = set(PERMISSIONS.values())
    if ALL_PERMISSIONS in perms:
        return perms
    if set(perms) - valid_perms:
        raise ValueError(
            'Invalid ACL permission names. Valid permissions '
            'are: {}'.format(', '.join(valid_perms)))
    return perms
798475
public void setIpPermissions(java.util.Collection<IpPermission> ipPermissions) {
        if (ipPermissions == null) {
            this.ipPermissions = null;
            return;
        }

        this.ipPermissions = new com.amazonaws.internal.SdkInternalList<IpPermission>(ipPermissions);
    }
746752
def set_permission(self, path, **kwargs):
        
        response = self._put(path, 'SETPERMISSION', **kwargs)
        assert not response.content
339608
protected function setFilePermissions($permissions)
    {
        $permissions = (int) $permissions;

        if (! (0b100000000 & $permissions)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid permissions "%s" for files. '
                . 'Files will not available for reading.',
                decoct($permissions)
            ));
        }
        if (! (0b010000000 & $permissions)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid permissions "%s" for files. '
                . 'Files will not available for writing.',
                decoct($permissions)
            ));
        }
        $this->filePermissions = $permissions;
    }
1362535
def set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'set_permissions', '-p',
         vhost, user, conf, write, read],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)
    msg = 'Permissions Set'
    return _format_response(res, msg)
360489
def permission_attributes=(permissions)
      self.permissions = [] # Reset permissions in anticipation for re-population
    
      permissions.each do |key, value|
        key, value = key.dup, value.dup
      
        # Component Permissions
        if key.ends_with? "_permissions"
          grant_permissions(value)
        # Singular Permission
        elsif key.chomp! "_permission"
          grant_permissions(key) if value.to_i != 0
        end
      end
    end
863794
@Override
    public void addPermissions(IPermission[] permissions) throws AuthorizationException {
        if (permissions.length > 0) {
            getPermissionStore().add(permissions);
            if (this.cachePermissions) {
                removeFromPermissionsCache(permissions);
            }
        }
    }
128152
def _setup_default_permissions(instance):
    """"""
    from abilian.services import get_service

    security = get_service("security")
    for permission, roles in instance.__default_permissions__:
        if permission == "create":
            # use str for comparison instead of `abilian.services.security.CREATE`
            # symbol to avoid imports that quickly become circular.
            #
            # FIXME: put roles and permissions in a separate, isolated module.
            continue
        for role in roles:
            security.add_permission(permission, role, obj=instance)
1080312
@Override
    public void addPermissions(final Collection<String> permissions) {
        CommonHelper.assertNotNull("permissions", permissions);
        this.permissions.addAll(permissions);
    }
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
138325
def set_content_permissions(self, user, obj, payload):
        """"""
        # Data doesn't have "ADD" permission, so it has to be removed
        payload = remove_permission(payload, 'add')

        for data in obj.data.all():
            if user.has_perm('share_data', data):
                update_permission(data, payload)
874351
async def check_permissions(self, action: str, **kwargs):
        
        for permission in await self.get_permissions(action=action, **kwargs):

            if not await ensure_async(permission.has_permission)(
                    scope=self.scope, consumer=self, action=action, **kwargs):
                raise PermissionDenied()