{@inheritdoc}

@see \Concrete\Core\Permission\Assignment\Assignment::getPermissionAccessObject()

@return \Concrete\Core\Permission\Access\PageAccess|null
336427
public function getPermissionAccessObject()
    {
        $app = Application::getFacadeApplication();
        $cache = $app->make('cache/request');
        $identifier = sprintf(
            'permission/assignment/access/%s/%s',
            $this->pk->getPermissionKeyHandle(),
            $this->getPermissionObject()->getPermissionObjectIdentifier()
        );
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            return $item->get();
        }
        $db = $app->make(Connection::class);
        $r = $db->fetchColumn('select paID from PagePermissionAssignments where cID = ? and pkID = ?', [$this->getPermissionObject()->getPermissionsCollectionID(), $this->pk->getPermissionKeyID()]);
        $pa = $r ? Access::getByID($r, $this->pk, false) : null;
        if ($pa) {
            $permissionObject = $this->getPermissionObject();
            if ($permissionObject->isPageDraft() && $permissionObject->getCollectionInheritance() == 'PARENT' && isset($this->inheritedPageTypeDraftPermissions[$this->pk->getPermissionKeyHandle()])) {
                $pageType = $permissionObject->getPageTypeObject();
                if (is_object($pageType)) {
                    $pk = Key::getByHandle($this->inheritedPageTypeDraftPermissions[$this->pk->getPermissionKeyHandle()]);
                    $pk->setPermissionObject($pageType);
                    $access = $pk->getPermissionAccessObject();
                    if (is_object($access)) {
                        $list_items = $access->getAccessListItems();
                        $pa->setListItems($list_items);
                    }
                }
            }
        }
        $cache->save($item->set($pa));

        return $pa;
    }
1134984
public static function getAccessToken(
        ContextInterface $context,
        array $scopes = null,
        array $options = []
    ): AccessToken
	{
		$formParams = [
			'grant_type' => 'client_credentials',
			'client_id' => $context->getClientId(),
			'client_secret' => $context->getClientSecret(),
		];

		if ($scopes !== null) {
			$formParams['scope'] = implode(',', $scopes);
		}

        $client = SumUp::getClient($options);

		$response = $client->request(
			'POST',
			self::OAUTH_TOKEN,
			[
				'form_params' => $formParams,
			]);

		$code = $response->getStatusCode();
		if ($code !== 200) {
			$message = " Request code: $code \n Message: " . $response->getReasonPhrase();
			throw new BadRequestException($message);
		}

		$body = json_decode($response->getBody()->getContents(), true);
		$token_params = [
			$body['access_token'],
			$body['token_type'],
			$body['expires_in'],
		];

		if (isset($body['scope'])) {
			$token_params[] = $body['scope'];
		}

		return new AccessToken(...$token_params);
	}
449436
public function pagePermissionsAction()
    {

        $view = new ViewModel();
        //fixes rendering site's header and footer in the dialog
        $view->setTerminal(true);

        /** @var \Rcm\Entity\Site $currentSite */
        $currentSite = $this->getServiceLocator()->get(
            \Rcm\Service\CurrentSite::class
        );

        $currentSiteId = $currentSite->getSiteId();

        $sourcePageName = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageName',
                'index'
            );

        $pageType = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageType',
                'n'
            );

        /** @var ResourceName $resourceName */
        $resourceName = $this->getServiceLocator()->get(
            ResourceName::class
        );

        $resourceId = $resourceName->get(
            ResourceName::RESOURCE_SITES,
            $currentSiteId,
            ResourceName::RESOURCE_PAGES,
            $pageType,
            $sourcePageName
        );

        /** @var \RcmUser\Acl\Service\AclDataService $aclDataService */
        $aclDataService = $this->getServiceLocator()->get(
            \RcmUser\Acl\Service\AclDataService::class
        );

        //getting all set rules by resource Id
        $rules = $aclDataService->getRulesByResource($resourceId)->getData();

        //getting list of all dynamically created roles
        $allRoles = $aclDataService->getNamespacedRoles()->getData();

        $rolesHasRules = [];

        foreach ($rules as $setRuleFor) {
            //getting only the ones that are allow
            if ($setRuleFor->getRule() == 'allow') {
                $rolesHasRules[] = $setRuleFor->getRoleId();
            }
        }

        $selectedRoles = [];

        foreach ($allRoles as $key => $role) {
            $roleId = $role->getRoleId();
            if (in_array($roleId, $rolesHasRules)) {
                $selectedRoles[$roleId] = $role;
            }
        }

        $data = [
            'siteId' => $currentSiteId,
            'pageType' => $pageType,
            'pageName' => $sourcePageName,
            'roles' => $allRoles,
            'selectedRoles' => $selectedRoles,
        ];

        $view->setVariable('data', $data);

        $view->setVariable(
            'rcmPageName',
            $sourcePageName
        );
        $view->setVariable(
            'rcmPageType',
            $pageType
        );

        return $view;
    }
542304
public function getPermissions()
    {
        // user permissions overridden from role.
        $permissions = \Cache::remember(
            'acl.getPermissionsById_'.$this->id,
            config('acl.cacheMinutes'),
            function () {
                return $this->getPermissionsInherited();
            }
        );

        // permissions based on role.
        // more permissive permission wins
        // if user has multiple roles we keep
        // true values.
        foreach ($this->roles as $role) {
            foreach ($role->getPermissions() as $slug => $array) {
                if ( array_key_exists($slug, $permissions) ) {
                    foreach ($array as $clearance => $value) {
                        if( !array_key_exists( $clearance, $permissions[$slug] ) ) {
                            ! $value ?: $permissions[$slug][$clearance] = true;
                        }
                    }
                } else {
                    $permissions = array_merge($permissions, [$slug => $array]);
                }
            }
        }

        return $permissions;
    }
598190
protected function _canAccess($object) {
        if(!is_object($object)) {
            $object=singleton($object);
        }
        
        //Ensure the object is an instance of CodeBank_APIClass
        if(!($object instanceof CodeBank_APIClass)) {
            //If in dev mode and object is an instance of ZendAmfServiceBrowser return true
            if(Director::isDev() && $object instanceof ZendAmfServiceBrowser) {
                return true;
            }
            
            return false;
        }
        
        
        //Fetch permissions from the object
        $perms=$object->getRequiredPermissions();
        
        //Check to see if the permissions are not empty
        if(!empty($perms) && $perms!==false) {
            //Ensure we have an array, if not throw an exception
            if(!is_array($perms)) {
                throw new Zend_Amf_Exception('CodeBank_APIClass::getRequiredPermissions() Should return an array of permissions to check');
                return false;
            }
            
            //Loop through and ensure the user has the required permissions return false if they are missing any
            foreach($perms as $permission) {
                if(!Permission::check($permission)) {
                    return false;
                }
            }
        }
        
        return true;
    }
1133587
public function getUser()
    {
        if (empty($this->obHelper)) {
            return null;
        }

        $sAuthFacadeClass = $this->obHelper->getAuthFacade();

        return $sAuthFacadeClass::getUser();
    }
85868
public function getAccessEntityTypeClass()
    {
        $class = overrideable_core_class('Core\\Permission\\Access\\Entity\\'
            . Loader::helper('text')->camelcase($this->petHandle) . 'Entity',
            DIRNAME_CLASSES . '/Permission/Access/Entity/'
            . Loader::helper('text')->camelcase($this->petHandle) . 'Entity.php',
            $this->getPackageHandle()
        );

        return $class;
    }
1169749
public function get($name)
    {
        if (!isset($this->permissions[$name])) {
            throw new InvalidArgumentException("Permissions $name for type $objectType not found.");
        }

        return $this->permissions[$name];
    }
1322161
public function getAccessToken()
    {
        if (! $this->accessTokenEntity instanceof AccessTokenEntity) {
            $this->accessTokenEntity = $this->server->getAccessTokenStorage()->get($this->accessTokenId);
        }

        return $this->accessTokenEntity;
    }
234341
public function getPermissions($resource = null)
    {
        $path = $this->getFullPathName();
        if (!empty($resource)) {
            $path = (!empty($path)) ? $path . '/' . $resource : $resource;
        }

        $requestType = ($this->request) ? $this->request->getRequestorType() : ServiceRequestorTypes::API;

        return Session::getServicePermissions($this->getServiceName(), $path, $requestType);
    }
36021
public function requestAccessToken()
    {
        $tokenUrl = $this->processUrl($this->server->getAccessTokenUrl());
        $accessToken = $this->instance->requestAccessToken($tokenUrl);
        $this->instance->setAccessToken($accessToken);

        return $accessToken;
    }
502148
function getAccessType()
    {
        if (!$this->_c__accMode instanceof AccessMode)
            $this->_c__accMode = new AccessMode;

        $this->assertMetaData();
        $mode = $this->getMetaKey('mode');
        if ($mode !== null)
            $this->_c__accMode->fromString($mode);

        return $this->_c__accMode;
    }
1119790
public function getPermissions()
    {
        if(!$this->permissions){
            $rolePermissions = $this->rolePermissions();
            $userPermissions = $this->grantedPermissions()->get();

            $permissions = $rolePermissions->merge($userPermissions);
            $deniedPermissions =$this->deniedPermissions()->get();

            $this->permissions = $permissions->filter(function($permission) use ($deniedPermissions)
            {
                return !$deniedPermissions->contains($permission);
            });
        }
        return $this->permissions;
    }
483844
public function getAccessor()
    {
        if ($this->accessor) {
            return $this->accessor;
        }

        $this->accessor = new DocumentAccessor($this->getDocument());

        return $this->accessor;
    }
1025088
public static function getResponse($object)
    {
        $cache = Core::make('cache/request');
        $identifier = sprintf('permission/response/%s/%s', get_class($object), $object->getPermissionObjectIdentifier());
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            return $item->get();
        }

        $className = $object->getPermissionResponseClassName();
        /** @var \Concrete\Core\Permission\Response\Response $pr */
        $pr = Core::make($className);
        if ($object->getPermissionObjectKeyCategoryHandle()) {
            $category = PermissionKeyCategory::getByHandle($object->getPermissionObjectKeyCategoryHandle());
            $pr->setPermissionCategoryObject($category);
        }
        $pr->setPermissionObject($object);
        $cache->save($item->set($pr));

        return $pr;
    }
524781
public function getPermissionsAction(Request $request)
    {
        $group = $request->attributes->get('group');
        $aclManager = $this->getContainer()->get('security.acl_manager');
        $parentClass = 'BackBee\ClassContent\AbstractClassContent';

        $categories['parent'] = [
            'class' => $parentClass,
            'rights' => $aclManager->getPermissions($parentClass, $group)
        ];

        $allClassContentClassNames = $this->getClassContentManager()->getAllClassContentClassnames();

        foreach ($this->getCategoryManager()->getCategories() as $id => $category) {

            foreach($category->getBlocks() as $key => $block){

                $className = AbstractClassContent::getClassnameByContentType($block->type);
                $block->rights = $aclManager->getPermissions($className, $group);
                $block->type = $className;

                $allClassContentClassNames = array_diff($allClassContentClassNames, [$className]);
            }

            if(false === empty($category->getBlocks())) {

                $categories['objects'][] = array_merge(['id' => $id], $category->jsonSerialize());
            }
        }

        $otherCategory = new Category('Other');

        foreach ($allClassContentClassNames as $class) {

            $content = new $class();

            if(false === $content->isElementContent()){

                if(null === $content->getProperty('name')){

                    $content->setProperty('name', $content->getContentType());
                }

                $otherCategory->addBlock($content);
            }
        }

        $categories['objects'][] = array_merge(['id' => 'other'], $otherCategory->jsonSerialize());

        return $this->createJsonResponse($categories, 200);
    }
607208
protected function _actionGetaccesstoken($context)
    {
        $this->getAPI()->requestAccessToken($this->getRequest());

        $token = (array) $this->getAPI()->getToken();
        $consumer = (array) $this->_consumer;

        AnRequest::set('session.oauth', array(
                            'api' => $this->getAPI()->getName(),
                            'token' => $token,
                            'consumer' => $consumer
                        ));

        $return = AnRequest::get('session.return', 'raw', null);

        if ($return) {
            $context->append(array('data' => array('return' => $return)));
        }
    }