Converts the query into an REVOKE with the given $permission.

@param  string $permission
@return Revoke
438438
public function revoke($permission)
    {
        $commandClass = $this->getCommandClass('revoke');
        $this->command = new $commandClass($permission);

        return $this->command;
    }
462280
public function revokePermission($permission, $user_id)
    {
        $user = \App\User::findorfail($user_id);

        $user->revokePermissionTo(str_slug($permission, ' '));

        return redirect('scaffold-users/edit/'.$user_id);
    }
1360998
public function addPermission($permission)
    {
        if (!$this->hasPermission($permission)) {
            return PermissionRole::create(['role_id' => $this->id, 'permission_id' => $permission->id]);
        }

        return false;
    }
1315050
protected function setPermissionSetting(Permission $permission, $allowed = true)
    {
        /** @var Model $this */
        if ($permission->isNewRecord()) {
            throw new PermissionException("The permission has not been saved.");
        }

        if ($this->isNewRecord()) {
            throw new PermissionException("The model has not been saved.");
        }

        $foreignKeyField = $this->getUniqueIdentifierColumnName();
        $foreignKeyValue = $this->getUniqueIdentifier();
        try {
            $assignment = PermissionAssignment::findFirst(
                new AndGroup([
                    new Equals('PermissionID', $permission->PermissionID),
                    new Equals($foreignKeyField, $foreignKeyValue),
                ])
            );
        } catch (RecordNotFoundException $ex) {
            $assignment = new PermissionAssignment();
            $assignment->PermissionID = $permission->PermissionID;
            $assignment->$foreignKeyField = $foreignKeyValue;
        }
        $assignment->Access = $allowed ? 'Allowed' : 'Denied';
        $assignment->save();

        return $assignment->PermissionAssignmentID;
    }
270856
public function checkPermission($permission)
    {
        $roleAttribute = "can_{$permission}";
        return isset($this->$roleAttribute) ? (bool)$this->$roleAttribute : false;
    }
333408
public function removePermission($permission)
    {
        if ($this->hasPermission($permission)) {
            $index =  array_search($permission, $this->permissions);
            unset($this->permissions[$index]);
        }

        return $this;
    }
196638
public function matchesPermission(Permission $permission)
    {
        return (
            $this instanceof $permission &&
            $this->action === $permission->getAction() && // Not using matchesAction to avoid the wildcard
            $this->matchesResource($permission->getResource())
        );
    }
640400
public function getPermission($permission)
    {
        if ($permission instanceof PermissionInterface) {
            $permission =   $permission->key;
        }

        return $this->permissions()
            ->key($permission)
            ->first();
    }
259408
public function permissionSave(Permission $permission)
    {
        if ($permission->permission_id) {
            $query = "
                UPDATE
                    auth_permission
                SET
                    `name` = :name, description = :description, updated_on = " . $this->sql_time_func . "
                WHERE
                    permission_id = :permission_id
            ";
        } else {
            $query = "
                INSERT INTO
                    auth_permission (`name`, description, updated_on, added_on)
                VALUES
                    (:name, :description, " . $this->sql_time_func . ", " . $this->sql_time_func . ")
            ";
        }
        $cur = $this->db->prepare($query);
        $cur->bindParam(":name", $permission->name, PDO::PARAM_STR, 32);
        $cur->bindParam(":description", $permission->description, PDO::PARAM_STR);
        if ($permission->permission_id) {
            $cur->bindParam(":permission_id", $permission->permission_id, PDO::PARAM_INT);
        }
        $this->db->beginTransaction();
        try {
            $cur->execute();
            if (!$permission->permission_id) {
                $permission->permission_id = $this->db->lastInsertId();
            }
            $this->db->commit();
        } catch (PDOException $db_err) {
            $this->db->rollBack();
            if ($this->logger) {
                $this->logger->error("Failed to create/update permission", ['exception' => $db_err]);
            }
            return false;
        }
        return true;
    }
520351
protected function getPermission($permission)
    {
        $name = $permission instanceof Permission
            ? $permission->getName()
            : $permission;

        return $this->permissions->filter(function(Permission $current) use ($name) {
            return $current->getName() == $name;
        })->first();
    }
312580
public function isPermitted( $permission ) {

		if( is_string( $permission ) ) {

			return in_array( $permission, $this->permissions );
		}
		else {

			$permitted = false;

			foreach( $permission as $perm ) {

				if( in_array( $perm, $this->permissions ) ) {

					$permitted = true;

					break;
				}
			}

			return $permitted;
		}
	}
1122290
private function removeDeletedPermissions(array $permission)
    {
        $configActions = collect($permission['actions']);

        $actions = Permissions::where('name', $permission['name'])->pluck('action');

        $removedActions = $actions->diff($configActions);

        if( ! $removedActions->isEmpty() )
            foreach ( $removedActions as $action )
                Permissions::deletePermission($action);
    }
740089
private function checkPermission($permission)
    {
        if (!$permission)
        {
            return;
        }

        $user = $this->securityApi->getUser(true);
        if ($user instanceof Permissible && $user->hasAccess($permission))
        {
            return;
        }

        throw Unauthorized::permissionDenied($permission, $this->securityApi);
    }
661373
public function can($permission)
  {
    if (is_array($permission)) {
      return (!! (count($permission) == count(array_intersect($this->permissions()->pluck('name')->toarray(), $permission))));
    } else {
      return in_array($permission, $this->permissions()->pluck('name')->toarray());
    }
  }
197247
public function removePermission(
        UUID $uuid,
        Permission $permission
    ) {
        if (in_array($permission, $this->permissions)) {
            $this->apply(new PermissionRemoved($uuid, $permission));
        }
    }
436024
protected function controlAccess($permission)
    {
        if (isset($this->uid) && !$this->user->access($permission, $this->uid)) {
            $this->errorAndExit($this->text('No access'));
        }
    }
115616
public function update($permission) {
        $data = Values::of(array('Permission' => Serialize::map($permission, function($e) { return $e; }), ));

        $payload = $this->version->update(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new RoleInstance(
            $this->version,
            $payload,
            $this->solution['serviceSid'],
            $this->solution['sid']
        );
    }