Helper to detect if we are in admin or development admin

@return boolean
972467
public static function isAdminBackend()
    {
        /* @var $controller Controller */
        $controller = Controller::curr();
        if (
            $controller instanceof LeftAndMain ||
            $controller instanceof DevelopmentAdmin ||
            $controller instanceof DatabaseAdmin ||
            (class_exists('DevBuildController') && $controller instanceof DevBuildController)
        ) {
            return true;
        }

        return false;
    }
92539
public function isAdminArea()
    {
        if ($this->isGeneratedCollection()) {
            $pos = strpos($this->getCollectionFilename(), '/'.DIRNAME_DASHBOARD);

            return ($pos > -1);
        }

        return false;
    }
1311382
public function getIsAdmin(HTTPRequest $request)
    {
        $adminPaths = static::config()->get('admin_url_paths');
        $adminPaths[] = AdminRootController::admin_url();
        $currentPath = rtrim($request->getURL(), '/') . '/';
        foreach ($adminPaths as $adminPath) {
            if (substr($currentPath, 0, strlen($adminPath)) === $adminPath) {
                return true;
            }
        }
        return false;
    }
363516
public function isLoggedIn()
    {
        $session = $this->Controller->request->session();
        if ($session->check('Auth.CakeAdmin')) {
            return (bool)$session->read('Auth.CakeAdmin');
        }
        return false;
    }
1365085
public function adminInit ()
    {
        set_current_screen($this->menuSlug);
        $this->doUserFunc(function (AdminPageMode $mode) {
            return $mode->getInitFunc();
        });
    }
10126
public function isAdminActive(AdminInterface $admin, $adminCode = '')
    {
        $active = false;
        if ($adminCode == $admin->getCode()) {
            $active = true;
        }

        if (method_exists($admin, 'getSubNavLinks')) {
            foreach ($admin->getSubNavLinks() as $value) {
                if ($value instanceof AdminInterface) {
                    if ($value->getCode() == $adminCode) {
                        $active = true;
                    }
                }
            }
        }

        return $active;
    }
1067576
public function handleMaintenanceMode()
    {
        // Authorize logged in admins on the fly
        if ($this->doesCurrentUserHaveAccess())
        {
            return true;
        }

        if (Craft::$app->request->isSiteRequest && $this->settings->maintenanceModeEnabled)
        {
            $requestingIp   = $this->getRequestingIp();
            $authorizedIps  = $this->settings->maintenanceModeAuthorizedIps;
            $maintenanceUrl = $this->settings->maintenanceModePageUrl;

            if ($maintenanceUrl == Craft::$app->request->getUrl())
            {
                return true;
            }

            if (empty($authorizedIps))
            {
                $this->forceRedirect($maintenanceUrl);
            }

            if (is_array($authorizedIps) && count($authorizedIps))
            {
                if (in_array($requestingIp, $authorizedIps))
                {
                    return true;
                }

                foreach ($authorizedIps as $authorizedIp)
                {
                    $authorizedIp = str_replace('*', '', $authorizedIp);

                    if (stripos($requestingIp, $authorizedIp) === 0)
                    {
                        return true;
                    }
                }

                $this->forceRedirect($maintenanceUrl);
            }
        }
    }
700076
public function isWordPressAdmin()
    {
        if (isset($GLOBALS['current_screen']) && is_a($GLOBALS['current_screen'], 'WP_Screen')) {
            return $GLOBALS['current_screen']->in_admin();
        } elseif (defined('WP_ADMIN')) {
            return WP_ADMIN;
        }

        return false;
    }
833333
public function adminAction()
    {
        $allowed    = Kernel::getConfig('expose_admin', false, 'user_config');
        $saveadmin  = $this->wdb->getUser()->getSession()->get('saveadmin');
        $this->wdb->getUser()->getSession()->remove('saveadmin');
        if (
            (!$allowed || ('true' !== $allowed && '1' !== $allowed)) &&
            (is_null($saveadmin) || $saveadmin != time())
        ) {
            throw new NotFoundException('Forbidden access!');
        }

        $user_config_file   = Kernel::getPath('user_config_filepath', true);
        $user_config        = Kernel::get('user_config');
        $title              = _T('Administration panel');
        $page_infos         = array(
            'name'              => $title,
            'path'              => 'admin',
        );
        $tpl_params         = array(
            'breadcrumbs'       => array($title),
            'title'             => $title,
            'page'              => $page_infos,
            'page_tools'        => 'false'
        );

        $content            = $this->wdb->display(
            '',
            'admin_panel',
            array(
                'page'          => $page_infos,
                'page_tools'    => 'false',
                'page_title'    => 'true',
                'title'         => $title,
                'user_config_file'=> $user_config_file,
                'user_config'   => $user_config,
                'config'        => Kernel::getConfig(),
            )
        );

        return array('default', $content, $tpl_params);
    }
819103
public function is_admin($id_chat): ?bool
  {
    if ( $this->check() && ($chat = $this->info($id_chat)) && !$chat['blocked'] ){
      return (bool)$this->db->count('bbn_chats_users', [
        'id_chat' => $id_chat,
        'id_user' => $this->user->get_id(),
        'admin' => 1
      ]);
    }
    return null;
  }
856052
public function isTabbed()
    {
        $ident    = $this->ident();
        $metadata = $this->adminSecondaryMenu();

        if (isset($metadata[$ident])) {
            return $this->hasLinks() ||
                   $this->hasGroups() ||
                   $this->hasActions();
        }

        return false;
    }
676629
public function isFrontendAdminSecure()
    {
        $frontend = $this->store->isFrontUrlSecure();
        $admin = $this->getWebsiteConfig(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML);
        $current = $this->store->isCurrentlySecure();

        if ($frontend && $admin && $current) {
            return true;
        }

        return false;
    }
1121433
def project_admin?(project = nil)
      return false unless project.is_a?(Array)
      # => parse_auth.include?(user) && parse_auth[user]['roles'].any? { |r| ['admin', project].include? r.to_s.downcase }
      auth['roles'].any? { |r| ['admin', project].include? r.to_s.downcase }
    end
943187
def is_admin_user(self):
        
        user = api.user.get_current()
        roles = user.getRoles()
        return "LabManager" in roles or "Manager" in roles
73199
protected function isEnabled()
    {
        // At least one redirect must be enabled
        if (!$this->getForceWWW() && !$this->getForceSSL()) {
            return false;
        }

        // Filter by env vars
        $enabledEnvs = $this->getEnabledEnvs();
        if (is_bool($enabledEnvs)) {
            return $enabledEnvs;
        }

        // If CLI, EnabledEnvs must contain CLI
        if (Director::is_cli() && !in_array('cli', $enabledEnvs)) {
            return false;
        }

        // Check other envs
        return empty($enabledEnvs) || in_array(Director::get_environment_type(), $enabledEnvs);
    }
339686
public function hasOrganizationData() {
        return ( !is_null( $this->organizationName ) && !is_null( $this->organizationUniqueName )
                 && !is_null( $this->organizationId ) && !is_null( $this->organizationVersion ) );
    }
546982
protected static function is_developer() {
        global $CFG;

        // Note we can not rely on $CFG->debug here because DB is not initialised yet.
        if (isset($CFG->config_php_settings['debug'])) {
            $debug = (int)$CFG->config_php_settings['debug'];
        } else {
            return false;
        }

        if ($debug & E_ALL and $debug & E_STRICT) {
            return true;
        }

        return false;
    }