Sets the permissions to the view
@method setPermissions
@param {array} permissions The permissions to set
@param {boolean} negative Flag to set a nagative permission (optional)
@memberof Augmented.View
557612
function(permissions, negative) {
            if (!negative) {
              negative = false;
            }
            if (permissions !== null && Array.isArray(permissions)) {
              if (negative) {
                this.permissions.exclude = permissions;
              } else {
                this.permissions.include = permissions;
              }
            }
          }
989138
public function setPermissions($permissions)
    {
        if (! is_array($permissions)) {
            $permissions = [$permissions];
        }

        $this->permissions = $permissions;

        return $this;
    }
510393
public function filterByPermission($permissions)
    {
        $permissions = is_array($permissions) ? $permissions : func_get_args();

        foreach ($permissions as $permission) {
            if (!$this->auth->user()->can($permission)) {
                throw new PermissionDeniedException("You don't have permission to \"{$permission}\".");
            }
        }
    }
1127105
func (s *ListPermissionsOutput) SetPermissions(v []*Permission) *ListPermissionsOutput {
	s.Permissions = v
	return s
}
968491
function (opts) {
    opts = opts || {};
    this.name = opts.name || 'unknown';
    this.userId = opts.userId;
    this.userRole = opts.userRole || 'anonymous';
    this.acl = opts.acl || {};
    this.permissions = opts.permissions || [];
}
211489
def -(other)
      raise "#{self.class} cannot handle #{other.class} with the minus operator" unless other.class == Permissions

      self_hash = Permissions.hashnize(self)
      other_hash = Permissions.hashnize(other)

      diff_permissions = (self_hash.keys - other_hash.keys).map do |key|
        self_hash[key]
      end

      Permissions.new(diff_permissions)
    end
767386
public function addPermissions($permissions) {
		foreach ($permissions as $permission) {
			$per                                 = new permission($permission);
			$this->role->sharedPermissionList [] = $per->get();
		}
		R::store($this->role);
	}
933415
def set_global_permissions(self, global_permissions):
        
        content = self._serialize.body(global_permissions, '[GlobalPermission]')
        response = self._send(http_method='PATCH',
                              location_id='a74419ef-b477-43df-8758-3cd1cd5f56c6',
                              version='5.0-preview.1',
                              content=content)
        return self._deserialize('[GlobalPermission]', self._unwrap_collection(response))
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()
80082
public void setUserPermission(String userName, Permission permission){
        if(permission == null){
            permission = Permission.NONE;
        }
        getServiceDirectoryClient().setACL(new ACL(AuthScheme.DIRECTORY, userName, permission.getId()));
    }
312800
public void setInboundPermissions(java.util.Collection<IpPermission> inboundPermissions) {
        if (inboundPermissions == null) {
            this.inboundPermissions = null;
            return;
        }

        this.inboundPermissions = new java.util.ArrayList<IpPermission>(inboundPermissions);
    }
1266102
public void setResourcePermissions(Map<String, Map<String, List<String>>> resourcePermissions) {
		this.resourcePermissions = resourcePermissions;
	}
326772
function $permission() {
    'ngInject';

    var defaultOnAuthorizedMethod = 'showElement';
    var defaultOnUnauthorizedMethod = 'hideElement';
    var suppressUndefinedPermissionWarning = false;

    /**
     * Methods allowing to alter default directive onAuthorized behaviour in permission directive
     * @methodOf permission.permissionProvider
     *
     * @param onAuthorizedMethod {String} One of permission.PermPermissionStrategies method names
     */
    this.setDefaultOnAuthorizedMethod = function (onAuthorizedMethod) { // jshint ignore:line
      defaultOnAuthorizedMethod = onAuthorizedMethod;
    };

    /**
     * Methods allowing to alter default directive onUnauthorized behaviour in permission directive
     * @methodOf permission.permissionProvider
     *
     * @param onUnauthorizedMethod {String} One of permission.PermPermissionStrategies method names
     */
    this.setDefaultOnUnauthorizedMethod = function (onUnauthorizedMethod) { // jshint ignore:line
      defaultOnUnauthorizedMethod = onUnauthorizedMethod;
    };


    /**
     * When set to true hides permission warning for undefined roles and permissions
     * @methodOf permission.permissionProvider
     *
     * @param value {Boolean}
     */
    this.suppressUndefinedPermissionWarning = function (value) { // jshint ignore:line
      suppressUndefinedPermissionWarning = value;
    };


    this.$get = function () { // jshint ignore:line
      return {
        defaultOnAuthorizedMethod: defaultOnAuthorizedMethod,
        defaultOnUnauthorizedMethod: defaultOnUnauthorizedMethod,
        suppressUndefinedPermissionWarning: suppressUndefinedPermissionWarning
      };
    };
  }
951018
def set_permission(self, permission, value, parent=False, admin=False):
        
        try:
            if not getattr(self, 'parent_{}'.format(permission)) and not parent and not admin:
                return False
            level = 'parent' if parent else 'self'
            setattr(self, '{}_{}'.format(level, permission), value)

            # Set student permission to false if parent sets permission to false.
            if parent and not value:
                setattr(self, 'self_{}'.format(permission), False)

            self.save()
            return True
        except Exception as e:
            logger.error("Error occurred setting permission {} to {}: {}".format(permission, value, e))
            return False
952061
public function hookUserRolePermissions(array &$permissions)
    {
        $permissions['module_file_manager'] = gplcart_text('File manager: access');

        foreach ($this->getHandlers() as $command_id => $command) {
            $permissions["module_file_manager_$command_id"] = gplcart_text('File manager: perform command @name', array(
                '@name' => $command['name']));
        }
    }
243034
public function setApplicationPermissions()
    {
        $files = (array) $this->config->getContextually('remote.permissions.files');
        foreach ($files as &$file) {
            $this->modulable->setPermissions($file);
        }

        return true;
    }
116490
function onAuthorizedAccess() {
          if (angular.isFunction(permission.onAuthorized)) {
            permission.onAuthorized()($element);
          } else {
            var onAuthorizedMethodName = $permission.defaultOnAuthorizedMethod;
            PermPermissionStrategies[onAuthorizedMethodName]($element);
          }
        }