Checks current user capabilities and admin pages.

@return bool
499500
public function can_update() {
		global $pagenow;

		// WP-CLI access has full capabilities.
		if ( static::is_wp_cli() ) {
			return true;
		}

		$can_user_update = current_user_can( 'update_plugins' ) && current_user_can( 'update_themes' );
		$this->load_options();

		$admin_pages = [
			'plugins.php',
			'plugin-install.php',
			'themes.php',
			'theme-install.php',
			'update-core.php',
			'update.php',
			'options-general.php',
			'options.php',
			'settings.php',
			'edit.php',
		];

		// Needed for sequential shiny updating.
		if ( isset( $_POST['action'] ) && in_array( $_POST['action'], [ 'update-plugin', 'update-theme' ], true ) ) {
			$admin_pages[] = 'admin-ajax.php';
		}

		/**
		 * Filter $admin_pages to be able to adjust the pages where GitHub Updater runs.
		 *
		 * @since 8.0.0
		 *
		 * @param array $admin_pages Default array of admin pages where GitHub Updater runs.
		 */
		$admin_pages = array_unique( apply_filters( 'github_updater_add_admin_pages', $admin_pages ) );

		return $can_user_update && in_array( $pagenow, $admin_pages, true );
	}
504700
public function have_pages() {
		$this->setup();

		$offset = $this->get_query_offset();

		return (bool) ( $offset < $this->total_posts );
	}
294641
public function checkIsAdmin()
    {
        $this->checkIsLogin();

        $user = new User($this->di->get("db"));
        $user = $user->getUser($this->di->get("session")->get("user"));

        if ($user->authority != "admin") {
            $views = [
                ["comment/admin/fail", [], "main"]
            ];
            $this->di->get("pageRenderComment")->renderPage([
                "views" => $views,
                "title" => "Not authorized"
            ]);
        }
    }
1234366
public function isUserAdmin()
	{
		$user = $this->getUsersDatabase();
		$sr = $user->getById($this->_context->authenticatedUserId());
		return ($sr->getField($user->getUserTable()->admin) == "yes");
	}
910133
public function validLoggedInAdmin()
    {
        $loggedInUser = $this->getCurrentLoggedInUser();
        if ($loggedInUser
            && $loggedInUser->administrator
            && $loggedInUser->deleted === null
            && $loggedInUser->enabled) {
                return true;
        }
        return false;
    }
723161
public function systems()
    {
        //Only admins and managers can access this controller
        if (!$this->Auth->isGroup(['admin', 'manager'])) {
            return;
        }

        $links[] = [__d('me_cms', 'Temporary files'), [
            'controller' => 'Systems',
            'action' => 'tmpViewer',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];

        //Only admins can manage logs
        if ($this->Auth->isGroup('admin')) {
            $links[] = [__d('me_cms', 'Log management'), [
                'controller' => 'Logs',
                'action' => 'index',
                'plugin' => 'MeCms',
                'prefix' => ADMIN_PREFIX,
            ]];
        }

        $links[] = [__d('me_cms', 'System checkup'), [
            'controller' => 'Systems',
            'action' => 'checkup',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Media browser'), [
            'controller' => 'Systems',
            'action' => 'browser',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Changelogs'), [
            'controller' => 'Systems',
            'action' => 'changelogs',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];

        return [$links, __d('me_cms', 'System'), ['icon' => 'wrench']];
    }
1365085
public function adminInit ()
    {
        set_current_screen($this->menuSlug);
        $this->doUserFunc(function (AdminPageMode $mode) {
            return $mode->getInitFunc();
        });
    }
492252
protected function canDeleteUser()
    {
        return isset($this->data_user['user_id'])
            && $this->access('user_delete')
            && $this->user->canDelete($this->data_user['user_id']);
    }
808190
protected function hasAccess()
    {
        return $this->module->password == Yii::$app->session->get(self::STYLEGUIDE_SESSION_PWNAME, false);
    }
1347374
public function showUsersTable()
    {
        $table = new AdminUsers(User::query());

        if (mustard_loaded('feedback')) {
            $table->with('feedbackReceived');
        }

        return view('mustard::admin.users', [
            'table' => $table,
            'users' => $table->paginate(),
        ]);
    }
1356084
protected function hasUsers()
    {
        try {
            $users = $this->app['users']->getUsers();
            if (empty($users)) {
                return false;
            }

            return true;
        } catch (TableNotFoundException $e) {
            return false;
        }
    }
172411
public function canAccess()
    {
        if (!$this->app->make('config')->get('concrete.updates.enable_permissions_protection')) {
            return true; // we have turned this off temporarily which means anyone even non-logged-in users can run update.
        }

        $p = new Checker();

        return $p->canUpgrade();
    }
875028
public function isExempt()
    {
        /*
         * This would grab the exempted routes from the maintenance.php config file
         *
         * An example of this file:
         * return [
         *   'exemptions' => [
         *     'user-groups' => [ 1, 2, 3 ],
         *   ],
         * ];
         */

        $exemptGroups = $this->app['config']->get('maintenancemode.exemptions.user-groups', []);
        $currentUser = $this->app['auth']->user();
        if(is_array($exemptGroups) && $currentUser !== null)
        {
            // Grab the current user group IDs
            $currentUserGroups = $currentUser->groups->modelKeys();

            // Check to see if the user is within this group
            if((is_array($currentUserGroups) && count(array_intersect($currentUserGroups, $exemptGroups))) ||
                !is_array($currentUserGroups) && in_array($currentUserGroups, $exemptGroups))
            {
                // The user matched the whitelist, they will NOT see the maintenance page
                return true;
            }
        }

        // The current user did not match the whitelist, therefore they MIGHT see the maintenance page (depending on other exemptions)
        return false;
    }
78941
public function admin_capabilities( $capabilities ) {

		foreach ( $this->components as $component => $component_data ) {
			if ( ! empty( $component_data['Hide'] ) ) {
				continue;
			}

			if ( ! pods_developer() ) {
				if ( true === (boolean) pods_v( 'DeveloperMode', $component_data, false ) ) {
					continue;
				}

				if ( true === (boolean) pods_v( 'TablelessMode', $component_data, false ) ) {
					continue;
				}
			}

			if ( empty( $component_data['MenuPage'] ) && ( ! isset( $component_data['object'] ) || ! method_exists( $component_data['object'], 'admin' ) ) ) {
				continue;
			}

			$capability = 'pods_component_' . str_replace( '-', '_', sanitize_title( str_replace( ' and ', ' ', strip_tags( $component_data['Name'] ) ) ) );

			if ( 0 < strlen( $component_data['Capability'] ) ) {
				$capability = $component_data['Capability'];
			}

			if ( ! in_array( $capability, $capabilities, true ) ) {
				$capabilities[] = $capability;
			}
		}//end foreach

		return $capabilities;
	}
369059
def can_view(self, user):
        """"""
        return user.is_admin or user in self.users \
            or self.project.class_ in user.admin_for
675666
private function checkVisitorDataIsReliable()
    {
        $data = $this->getVisitorData();

        foreach (['user_id', 'client_ip', 'user_agent'] as $key) {
            if ($this->checkDataIsUnreliable($data, $key)) return false;
        }

        return true;
    }
376043
public function hasSuperUser()
    {

        $permissions = $this->getAllPermissions();

        foreach ($permissions as $permission)
            if ($permission === 'superuser') return true;

        return false;
    }