Get all permission access

@param string $requester The requesting identifier (Aro).
@param string $controlled The controlled identifier (Aco).
180703
public function get($requester, $request) {
		$permission = $this->_classes['permission'];
		return $permission::get($requester, $request);
	}
81079
public function getAccessListItems($accessType = PermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = [], $checkCache = true)
    {
        if (count($this->paIDList) > 0) {
            $q = 'select paID, peID, pdID, accessType from PermissionAccessList where paID in (' . implode(',', $this->paIDList) . ')';

            return $this->deliverAccessListItems($q, $accessType, $filterEntities);
        }
        // Sometimes we want to disable cache checking here because we're going to be
        // adding items to the cache from a class that subclasses this one. See
        // AddBlockToAreaAreaAccess
        if ($checkCache) {
            $app = Application::getFacadeApplication();
            $cache = $app->make('cache/request');
            $item = $cache->getItem($this->getCacheIdentifier($accessType, $filterEntities));
            if (!$item->isMiss()) {
                return $item->get();
            }
            $item->lock();
        }

        $q = 'select paID, peID, pdID, accessType from PermissionAccessList where paID = ' . $this->getPermissionAccessID();
        $items = $this->deliverAccessListItems($q, $accessType, $filterEntities);

        if ($checkCache) {
            $cache->save($item->set($items));
        }

        return $items;
    }
1204582
public function hasPermission($permissionName, Subject $subject, Resource $resource = null, array $params = [])
    {
        return in_array($permissionName, $this->getPermissions($subject, $resource, $params));
    }
756404
private function getAccess($accessType, $userId)
    {
        if (!isset($this->permissionsById[$userId]))
        {
            return false;
        }
        if (!isset($this->permissionsById[$userId][$accessType]))
        {
            return false;
        }

        return $this->permissionsById[$userId][$accessType];
    }
357213
public function triggerDelete($requester)
    {
        $v = [$this->getUserID()];
        $pkr = new DeleteUserWorkflowRequest();
        $pkr->setRequestedUserID($this->getUserID());
        $pkr->setRequesterUserID($requester->getUserID());
        $pkr->trigger();

        return $this->connection->fetchColumn('select uID from Users where uID = ? limit 1', $v) ? false : true;
    }
1204014
public function getPermissions($type, $identifier)
    {
        $accessControls = $this->accessControlRepository->findByTypeAndId($type, $identifier);

        $permissions = [];
        foreach ($accessControls as $accessControl) {
            $permissions[$accessControl->getRole()->getId()] = $this->maskConverter->convertPermissionsToArray(
                $accessControl->getPermissions()
            );
        }

        return $permissions;
    }
739275
public function deny($requester, $controlled, $perms = "*") {
		$permission = $this->_classes['permission'];
		return $permission::allow($requester, $controlled, $perms, -1);
	}
900601
protected function initPermission(RequesterInterface $requester, ResourceInterface $resource, $mask = 0)
    {
        $maskBuilder = $this->getMaskBuilder();
        $maskBuilder->set($mask);

        return new Permission($requester, $resource, $maskBuilder);
    }
536353
public function grantAccessByPermissions($permissions, UserInterface $user = null)
    {
        $user = $user ? : $this->currentUser;
        return count(array_diff($permissions, $this->gatherPermissions($user))) === 0;
    }
628132
public static function check($requester, $controlled, $privileges) {
		$self = static::_object();
		$aro = $self->_classes['aro'];
		$aco = $self->_classes['aco'];

		if (!(
			($aroNodes = $aro::node($requester, false)) &&
			($acoNodes = $aco::node($controlled, false))
		)) {
			return false;
		}

		$inherited = [];
		$required = (array) $privileges;
		$count = count($required);
		$aro_id = key(static::relations('Aro')->key());
		$aco_id = key(static::relations('Aco')->key());
		$ids = Set::extract($acoNodes, '/'.$aco::meta('key'));
		$left = $aco::actsAs('Tree', true, 'left');

		foreach ($aroNodes as $node) {
			$id = $node[$aro::meta('key')];
			if ($datas = static::_permQuery($id, $ids, $aro_id, $aco_id, $left)) {
				foreach ($datas as $data) {
					if (!$privileges = json_decode($data['privileges'], true)) {
						break;
					}
					foreach ($required as $key) {
						if (isset($privileges[$key])) {
							if(!$privileges[$key]) {
								$self->_error = ['message' => $self->_forbid];
								return false;
							} else {
								$inherited[$key] = 1;
							}
						}
					}
					if (count($inherited) === $count) {
						$self->_error = [];
						return true;
					}
				}
			}
		}
		$self->_error = ['message' => $self->_forbid];
		return false;
	}
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;
    }
477689
private function checkPermission(Node $node, $permission)
    {
        if (false === $this->authorizationChecker->isGranted($permission, $node)) {
            throw new AccessDeniedException();
        }
    }
1167089
@Override
    public boolean requestPermissionToRead() {
        boolean rc = false;
        synchronized (this) {
            if ((currentState & READ_NOT_ALLOWED_MASK) == 0) {
                currentState = (currentState | READ_PENDING) & READ_PENDING_CLEAR_OUT;
                rc = true;
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "requestPermissionToRead returning " + rc);
        }
        return rc;
    }
1104989
public static function getServicePermissions($service, $component = null, $requestor = ServiceRequestorTypes::API)
    {
        if (static::isSysAdmin()) {
            return
                VerbsMask::GET_MASK |
                VerbsMask::POST_MASK |
                VerbsMask::PUT_MASK |
                VerbsMask::PATCH_MASK |
                VerbsMask::DELETE_MASK;
        }

        $roleId = Session::getRoleId();
        if ($roleId && !Role::getCachedInfo($roleId, 'is_active')) {
            return false;
        }

        $services = (array)static::get('role.services');
        $service = strval($service);
        $component = ltrim(strval($component), '/');
        if ((false !== $parenStart = strpos($component, '(')) && (false !== $parenEnd = strpos($component, ')'))) {
            $component = substr_replace($component, '', $parenStart, $parenEnd - $parenStart + 1);
        }

        //  If exact match found take it, otherwise follow up the chain as necessary
        //  All - Service - Component - Sub-component
        $allAllowed = VerbsMask::NONE_MASK;
        $allFound = false;
        $serviceAllowed = VerbsMask::NONE_MASK;
        $serviceFound = false;
        $componentAllowed = VerbsMask::NONE_MASK;
        $componentFound = false;
        $exactAllowed = VerbsMask::NONE_MASK;
        $exactFound = false;
        foreach ($services as $svcInfo) {
            $tempRequestors = array_get($svcInfo, 'requestor_mask', ServiceRequestorTypes::API);
            if (!($requestor & $tempRequestors)) {
                //  Requestor type not found in allowed requestors, skip access setting
                continue;
            }

            $tempService = strval(array_get($svcInfo, 'service'));
            $tempComponent = strval(array_get($svcInfo, 'component'));
            $tempVerbs = array_get($svcInfo, 'verb_mask');

            if (0 == strcasecmp($service, $tempService)) {
                if (!empty($component)) {
                    if (0 == strcasecmp($component, $tempComponent)) {
                        // exact match
                        $exactAllowed |= $tempVerbs;
                        $exactFound = true;
                    } elseif ((false !== $tempCompStarPos = strpos($tempComponent, '*')) &&
                        (0 == strcasecmp(substr($component . '/', 0, $tempCompStarPos) . '*', $tempComponent))
                    ) {
                        $componentAllowed |= $tempVerbs;
                        $componentFound = true;
                    } elseif ('*' == $tempComponent) {
                        $serviceAllowed |= $tempVerbs;
                        $serviceFound = true;
                    } elseif ((false !== $wildcardStart = strpos($component, '{')) &&
                        (false !== $wildcardEnd = strpos($component, '}'))) {
                        $compReg = '^' . substr_replace($component, '[a-zA-Z0-9_]{1,}$', $wildcardStart,
                                $wildcardEnd - $wildcardStart + 1);
                        $compReg = str_replace('/', '\/', $compReg);
                        if ((false !== preg_match("/$compReg/", $tempComponent, $matches)) && !empty($matches)) {
                            $componentAllowed |= $tempVerbs;
                            $componentFound = true;
                        }
                    }
                } else {
                    if (empty($tempComponent)) {
                        // exact match
                        $exactAllowed |= $tempVerbs;
                        $exactFound = true;
                    } elseif ('*' == $tempComponent) {
                        $serviceAllowed |= $tempVerbs;
                        $serviceFound = true;
                    }
                }
            } else {
                if (empty($tempService) && (('*' == $tempComponent) || (empty($tempComponent) && empty($component)))) {
                    $allAllowed |= $tempVerbs;
                    $allFound = true;
                }
            }
        }

        if ($exactFound) {
            return $exactAllowed;
        } elseif ($componentFound) {
            return $componentAllowed;
        } elseif ($serviceFound) {
            return $serviceAllowed;
        } elseif ($allFound) {
            return $allAllowed;
        }

        return VerbsMask::NONE_MASK;
    }
442294
private function getPermissions($request)
    {
        $routeActions = $this->getActions($request);

        $permissions = array_get($routeActions, 'shield', []);

        return is_array($permissions) ? $permissions : (array) $permissions;
    }
60161
public function hasAccess($permissions, $all = true)
    {
        $key = sha1(json_encode($permissions).json_encode($all));

        if (!array_key_exists($key, $this->access)) {
            $this->access[$key] = parent::hasAccess($permissions, $all);
        }

        return $this->access[$key];
    }
447738
def check_permissions(self, request):
        
        obj = (
            hasattr(self, 'get_controlled_object') and self.get_controlled_object() or
            hasattr(self, 'get_object') and self.get_object() or getattr(self, 'object', None)
        )
        user = request.user

        # Get the permissions to check
        perms = self.get_required_permissions(self)

        # Check permissions
        has_permissions = self.perform_permissions_check(user, obj, perms)

        if not has_permissions and not user.is_authenticated:
            return HttpResponseRedirect('{}?{}={}'.format(
                resolve_url(self.login_url),
                self.redirect_field_name,
                urlquote(request.get_full_path())
            ))
        elif not has_permissions:
            raise PermissionDenied