Delete a capability

@param string $capability

@return bool
768769
final public function delete($capability) {

        if ( array_key_exists($capability, $this->rpc_capabilities) ) {

            unset($this->rpc_capabilities[$capability]);

            $this->logger->debug("Deleted capability $capability");

            return true;

        } else {

            $this->logger->warning("Cannot delete capability $capability: entry not found");

            return false;

        }

    }
873376
protected static function hasTypeAccessFull(array $capabilities, array $user, array $url): bool
    {
        foreach ($capabilities as $capability) {
            if (static::hasAccessInCapabilities($capability->getName(), $user['id'])) {
                return true;
            }
        }

        return false;
    }
533636
function canRemove( )
    {
        if ( !isset( $this->Permissions["can_remove"] ) )
        {
            $this->Permissions["can_remove"] = $this->checkAccess( 'remove' );
        }
        return ( $this->Permissions["can_remove"] == 1 );
    }
792775
static function delete($from)
    {
        $from = self::makeVirtualDir($from, false);
        $result = false;
        if (is_file($from)){
            @unlink($from);
            $result = true;
        }
        self::deleteVirtualDir($from);
        return $result;
    }
25239
public function delete($force = false)
    {
        $this->getParent()->channelDelete($this->getId(), $force);

        unset($this);
    }
1140947
public static function delete_plan($id) {
        global $DB;
        static::require_enabled();

        $plan = new plan($id);

        if (!$plan->can_manage()) {
            $context = context_user::instance($plan->get('userid'));
            throw new required_capability_exception($context, 'moodle/competency:planmanage', 'nopermissions', '');
        }

        // Wrap the suppression in a DB transaction.
        $transaction = $DB->start_delegated_transaction();

        // Delete plan competencies.
        $plancomps = plan_competency::get_records(array('planid' => $plan->get('id')));
        foreach ($plancomps as $plancomp) {
            $plancomp->delete();
        }

        // Delete archive user competencies if the status of the plan is complete.
        if ($plan->get('status') == plan::STATUS_COMPLETE) {
            self::remove_archived_user_competencies_in_plan($plan);
        }
        $event = \core\event\competency_plan_deleted::create_from_plan($plan);
        $success = $plan->delete();

        $transaction->allow_commit();

        // Trigger deleted event.
        $event->trigger();

        return $success;
    }
1293005
public static function delete_user_evidence($id) {
        static::require_enabled();
        $userevidence = new user_evidence($id);
        $context = $userevidence->get_context();

        if (!$userevidence->can_manage()) {
            throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
        }

        // Delete the user evidence.
        $userevidence->delete();

        // Delete associated files.
        $fs = get_file_storage();
        $fs->delete_area_files($context->id, 'core_competency', 'userevidence', $id);

        // Delete relation between evidence and competencies.
        $userevidence->set('id', $id);     // Restore the ID to fully mock the object.
        $competencies = user_evidence_competency::get_competencies_by_userevidenceid($id);
        foreach ($competencies as $competency) {
            static::delete_user_evidence_competency($userevidence, $competency->get('id'));
        }

        // Trigger an evidence of prior learning deleted event.
        \core\event\competency_user_evidence_deleted::create_from_user_evidence($userevidence)->trigger();

        $userevidence->set('id', 0);       // Restore the object.

        return true;
    }
1274475
public function delete()
	{
		$asset = Model::oneByName($this->getAssetName());

		if ($asset->get('id'))
		{
			if (!$asset->destroy())
			{
				return false;
			}
		}

		return true;
	}
476991
public function delete(string $uri)
    {
        $request = $this->getRequest($uri)
            ->setMethod('DELETE');

        return $this->send($request);
    }
11415
final public function require_capability($capability, $user = null) {
        if (!is_int($user)) {
            $user = null;
        }
        $this->requiredcapabilities[] = array(
            'capability' => $capability,
            'user' => $user
        );
    }
561481
public function can($capability, $args = null)
	{
		if (!$this->user())
		{
			return false;
		}

		$userCan = false;

		if (is_array($capability))
		{
			foreach ($capability as $cap)
			{
				// if only one capability is accepted
				if (current_user_can($cap, $args) === true)
				{
					$userCan = true;
					break;
				}
			}
		}
		else
		{
			$userCan = current_user_can($capability, $args);
		}

		return $userCan;
	}
505374
public function user_can( $capability = null ) {
		if ( ! isset( $capability ) ) {
			$capability = $this->app->get_config( 'capability', 'default_user', 'manage_options' );
		}
		if ( false === $capability ) {
			return true;
		}
		if ( '' === $capability ) {
			return false;
		}

		return $this->has_cap( $capability ) || in_array( $capability, $this->user_roles );
	}
1292686
public function delete($where = [], $limit = null)
    {
        $this->where($where);

        if (isset($limit)) {
            $this->limit($limit);
        }

        return $this->platformDeleteHandler($this->builderCache);
    }
176234
public function getGroupIDForCapability($capability)
    {
        if (!isset($capability) || !array_key_exists($capability, $this->groupIDCapabilitiesMap)) {
            throw new \InvalidArgumentException('an invalid capability was specified.');
        }

        return $this->groupIDCapabilitiesMap[$capability];
    }
1299143
public function delete($key)
    {
        if ($this->has($key)) {
            return shm_remove_var($this->shm, $this->shm_key($key));
        } else {
            return false;
        }
    }
892935
public static function isUserHasCapability($idSites, $capability)
    {
        try {
            self::checkUserHasCapability($idSites, $capability);
            return true;
        } catch (Exception $e) {
            return false;
        }
    }
436043
public function getGroupIDForCapability($capability)
    {
        if (!isset($capability) || !array_key_exists($capability, $this->_groupIDCapabilitiesMap)) {
            throw new InvalidArgumentException("an invalid capability was specified.");
        }
        return $this->_groupIDCapabilitiesMap[$capability];
    }