Returns array of relevant context capability records.

@return array
187007
public function get_capabilities() {
        global $DB;

        $sort = 'ORDER BY contextlevel,component,name';   // To group them sensibly for display

        $params = array();
        $sql = "SELECT *
                  FROM {capabilities}
                 WHERE contextlevel IN (".CONTEXT_COURSECAT.",".CONTEXT_COURSE.",".CONTEXT_MODULE.",".CONTEXT_BLOCK.")";

        return $DB->get_records_sql($sql.' '.$sort, $params);
    }
1171062
public function getRoles()
    {
        global $wpdb;
        $capabilities = get_user_meta($this->ID, $wpdb->prefix . 'capabilities', true);

        return is_array($capabilities) ? array_keys($capabilities) : array(
            'non-user'
        );
    }
922550
public function getAllCapabilities()
    {
        $capabilities = array();
        foreach (array_reverse($this->modelDevices) as $modelDevice) {
            $capabilities = array_merge($capabilities, $modelDevice->getCapabilities());
        }
        return $capabilities;
    }
903620
public function getContext(): ?array
    {
        if ($this->currentRequest === null) {
            return null;
        }

        $controller = null;

        if ($route = $this->currentRequest->route()) {
            $controller = $route->controller;

            if (! $controller && ! is_string($route->action['uses'])) {
                $controller = $route->action['uses'];
            }
        }

        return [
            'uri' => $this->currentRequest->getUri(),
            'method' => $this->currentRequest->getMethod(),
            'controller' => $controller ? $this->cloner->cloneVar(class_basename($controller)) : $controller,
            'identifier' => spl_object_hash($this->currentRequest),
        ];
    }
1281129
public function getContextData(): Array
    {
        return [
        'id' => $this->getId(),
        'name' => $this->getName(),
        'client_id' => $this->getClientId(),
        'client_secret' => $this->getClientSecret(),
        'application_type' => $this->getApplicationType(),
        'redirect_uris' => $this->getRedirectUris(),
        'cors_uris' => $this->getCorsUris()
        ];
    }
549713
public function contexts()
    {
        if (is_null($this->contextRequests)) {
            $this->contextRequests = new ContextRequests($this->client);
        }

        return $this->contextRequests;
    }
462317
protected function getContextParameters()
    {
        if ($this->contextParameters === null) {
            $this->contextParameters    = stream_context_get_params($this->context);
        }
        return $this->contextParameters;
    }
682855
public static function getAuditTables()
    {
        $connection = Yii::$app->db;
        $schema = $connection->schema;
        $tables = $schema->getTableNames('audits');
        $map = [];
        $map[] = Yii::t('app', 'Choose');
        foreach ($tables as $table) {
            $map[$table] = $table;
        }
        return $map;
    }
1078479
public function getStatusAllowableValues()
    {
        return [
            self::STATUS_OK,
            self::STATUS_ERROR,
            self::STATUS_CREATING,
            self::STATUS_DELETING,
            self::STATUS_UPDATING,
            self::STATUS_DISABLED,
        ];
    }
1191032
public static function get_enabled_plugins() {
        global $CFG;

        $enabled = array();
        foreach (explode(',', $CFG->enrol_plugins_enabled) as $enrol) {
            $enabled[$enrol] = $enrol;
        }

        return $enabled;
    }
58493
public function getEnabledPluginActions()
    {
        $enabledActionsList = array();

        $configValues = $this->config->toArray();

        // find all settings that start with "enable_" in the config-value-name and collect all active ones
        $searchKeyPart = 'enable_';
        foreach ($configValues as $key => $val) {
            if (substr($key, 0, strlen($searchKeyPart)) == $searchKeyPart) {
                if ($val) {
                    $enabledActionsList[$key] = $val;
                }
            }
        }

        return $enabledActionsList;
    }
785134
private function getBelongTo(): array
    {
        $result = [];

        if (! isset($this->capabilities['action'][Utils::getTypeBelongs()])) {
            return $result;
        }

        $table = TableRegistry::getTableLocator()->get('RolesCapabilities.Capabilities');
        Assert::isInstanceOf($table, CapabilitiesTable::class);

        $groups = $table->getUserGroups($this->user['id']);
        // check user capabilities against action's belongs capabilities
        foreach ($this->capabilities['action'][Utils::getTypeBelongs()] as $capability) {
            if (in_array($capability->getName(), $this->capabilities['user'])) {
                // if user has owner capability for current action add appropriate conditions to where clause
                $result[$this->table->aliasField($capability->getField()) . ' IN'] = array_keys($groups);
            }
        }

        return $result;
    }
88593
public function getAccesses()
    {
        return $this->abilities->mapWithKeys(function ($item, $key) {
            return [$key => $this->can($key)];
        });
    }
510065
final protected function getContextChoices()
    {
        $contextChoices = [];
        /* @var ContextInterface $context */
        foreach ($this->contextManager->findAll() as $context) {
            $contextChoices[$context->getId()] = $context->getName();
        }

        return $contextChoices;
    }
1281181
protected function get_context_options() {
        if ($this->contextoptions === null) {
            $this->contextoptions = array();
            $displaylist = core_course_category::make_categories_list('moodle/cohort:manage');
            // We need to index the options array by context id instead of category id and add option for system context.
            $syscontext = context_system::instance();
            if (has_capability('moodle/cohort:manage', $syscontext)) {
                $this->contextoptions[$syscontext->id] = $syscontext->get_context_name();
            }
            foreach ($displaylist as $cid => $name) {
                $context = context_coursecat::instance($cid);
                $this->contextoptions[$context->id] = $name;
            }
        }
        return $this->contextoptions;
    }
1295956
private function getActiveHandlers()
    {
        $handlers = [];
        foreach ($this->handlers as $keyword => $handler) {
            if (array_key_exists($keyword, $this->capabilities)) {
                $handlers[] = $handler;
            }
        }

        return $handlers;
    }
128759
public static function getContextTypes(): array
    {
        return [
            self::CONTEXT_TYPE_CONTROLLER => __d('model_history', 'context.type.controller'),
            self::CONTEXT_TYPE_SHELL => __d('model_history', 'context.type.shell'),
            self::CONTEXT_TYPE_SLUG => __d('model_history', 'context.type.slug')
        ];
    }