Aktualizuje ustawienie ACL
@param \Cms\Orm\CmsCategoryAclRecord $aclRecord
194780
protected function _updateAcl(\Cms\Orm\CmsCategoryAclRecord $aclRecord)
    {
        //iteracja po identyfikatorach kategorii
        foreach ($this->_getChildrenCategoryIds($aclRecord->cmsCategoryId) as $categoryId) {
            //dozwalanie lub zabranianie w ACL
            $aclRecord->access == 'allow' ?
                    $this->_acl->allow($aclRecord->getJoined('cms_role')->name, $categoryId) :
                    $this->_acl->deny($aclRecord->getJoined('cms_role')->name, $categoryId);
        }
    }
126959
public static function grant($cmsAuthId, array $roles, $revoke = true)
    {
        //usuwa wszystkie role
        if ($revoke) {
            CmsAuthRoleQuery::byAuthId($cmsAuthId)
                ->find()
                ->delete();
        }
        //iteracja po rolach
        foreach ($roles as $roleId) {
            //rola istnieje
            if (null !== (new CmsAuthRoleQuery)
                    ->whereCmsRoleId()->equals($roleId)
                    ->andFieldCmsAuthId()->equals($cmsAuthId)
                    ->findFirst()) {
                continue;
            }
            //zapis rekordu
            $record = new CmsAuthRoleRecord;
            $record->cmsAuthId = $cmsAuthId;
            $record->cmsRoleId = $roleId;
            $record->save();
        }
    }
800362
protected function _prepareData()
	{
        //próba pobrania struktury uprawnień z cache
        if (null !== $this->_acl = \App\Registry::$cache->load($cacheKey = 'categories-roles')) {
			return;
        }
		$this->_acl = [];
		//zapytanie o całą strukturę powiązań: kategorie - role
		foreach ((new \Cms\Orm\CmsCategoryRoleQuery())
					->join('cms_role')->on('cms_role_id')
					->orderAscCmsCategoryId()
					->find() as $record) {
			if (!array_key_exists($record->cmsCategoryId, $this->_acl)) {
				$this->_acl[$record->cmsCategoryId] = [];
			}
			$this->_acl[$record->cmsCategoryId][] = $record->getJoined('cms_role')->name;
		}
        //zapis struktury uprawnień do cache
        \App\Registry::$cache->save($this->_acl, $cacheKey, 0);
	}
579498
private function createRules(Permission $permission): void
	{
		/* @var $rule Acl */
		foreach ($this->orm->acl->findAll() as $rule) {
			if ($rule->allowed) {
				$permission->allow($rule->role->name, $rule->resource->resource, $rule->privilege);
			} else {
				$permission->deny($rule->role->name, $rule->resource->resource, $rule->privilege);
			}
		}
	}
733562
public function putObjectAcl($bucket, $object, $acl)
    {
        $this->precheckCommon($bucket, $object, $options, true);
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
        $options[self::OSS_OBJECT] = $object;
        $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_ACL => $acl);
        $options[self::OSS_SUB_RESOURCE] = 'acl';
        $response = $this->auth($options);
        $result = new PutSetDeleteResult($response);
        return $result->getData();
    }
501456
public function deleteAction()
    {
        //szukamy rekordu pliku
        if (!$this->getPost()->cmsFileId || null === $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
            return $this->_jsonError(178);
        }
        //sprawdzenie zgodności z obiektem formularza
        if ($record->object === $this->getPost()->object && $record->objectId == $this->getPost()->objectId) {
            //usuwanie
            if ($record->delete()) {
                //jeśli wykonać operację po usunięciu
                if ($this->getPost()->afterDelete) {
                    $this->_operationAfter($this->getPost()->afterDelete, $record);
                }
                return json_encode(['result' => 'OK']);
            }
        }
        return $this->_jsonError(178);
    }
1368812
public static function acl($requester, $controlled) {
		$self = static::_object();
		$aro = $self->_classes['aro'];
		$aco = $self->_classes['aco'];

		if (!(($aroNode = $aro::node($requester)) && ($acoNode = $aco::node($controlled)))) {
			return false;
		}

		$acl = static::find('first', [
				'conditions' => [
					key(static::relations('Aro')->key()) => $aroNode[0]['id'],
					key(static::relations('Aco')->key()) => $acoNode[0]['id']
				],
				'return' => 'array'
		]);
		if (isset($acl['privileges'])) {
			$acl['privileges'] = json_decode($acl['privileges'], true);
		}

		return [
			'aro' => $aroNode[0]['id'],
			'aco' => $acoNode[0]['id'],
			'acl' => isset($acl) ? $acl: []
		];
	}
754577
public function setDefaultAcl($aclId) {
	
		// set no default to siblings
		Database::run('UPDATE `acl` SET `is_default` = 0 WHERE `group_id` = ? AND `id` <> ?', [$this->id, $aclId]);

		// set default to this
		Database::run('UPDATE `acl` SET `is_default` = 1 WHERE `group_id` = ? AND `id` = ?', [$this->id, $aclId]);
		
	}
956693
protected function _setAuthentication(\Mmi\Security\AuthRecord $record)
    {
        //przekazanie danych z rekordu autoryzacji do sesji
        $this->_session->setFromArray((array)$record);
        return true;
    }
1127272
private function extractAcl(Response $resp) {
        $headers = $resp->getHeaders();
        foreach ($headers['Link'] ?? [] as $i) {
            if (preg_match('/; ?rel="?acl"?$/', $i)) {
                $i      = explode(";", $i);
                $newUrl = substr(trim($i[0]), 1, -1);
                if ($this->aclUrl !== $newUrl) {
                    $this->acl = null;
                }
                $this->aclUrl = $newUrl;
                return;
            }
        }
        $this->aclUrl = '';
        $this->acl    = null;
    }
945320
public function GenerateQrCode(int $acls = GnMashupLoginAcl::None)
    {
        $qrCode = parent::GenerateQrCodeInternal(GnSettings::GPSNOSE_COMMUNITY, TRUE, TRUE, $acls);

        return $qrCode;
    }
243398
public function setObjectACL($entity, $aces, $type)
    {
        if ($type != "object") {
            throw new \RuntimeException('ACEs of type ' . $type . ' are not supported.');
        }

        $acl     = $this->getAcl($entity);
        $oldAces = $acl->getObjectAces();

        // Delete old ACEs
        foreach (array_reverse(array_keys($oldAces)) as $idx) {
            $acl->deleteObjectAce(intval($idx));
        }
        $this->aclProvider->updateAcl($acl);
        // Add new ACEs
        foreach (array_reverse($aces) as $idx => $ace) {
            // If no mask is given, we might as well not insert the ACE
            if ($ace['mask'] === 0) {
                continue;
            }
            $acl->insertObjectAce($ace['sid'], $ace['mask']);
        }

        $this->aclProvider->updateAcl($acl);
    }
1015484
public static function setObjectACL($key, $bucket, $acl = 'public-read')
    {
        $s3c = self::getS3C();
        if ($s3c->doesObjectExist($bucket, $key)) {
            $result = $s3c->putObjectAcl(array(
                'ACL' => $acl,
                'Bucket' => $bucket,
                'Key' => $key,
            ));
            if ($result) {
                return true;
            }
        }

        return false;
    }
806414
public function categoryWidget(\Cms\Orm\CmsCategoryWidgetCategoryRecord $widgetRelation)
    {
        $widgetRecord = $widgetRelation->getWidgetRecord();
        //próba odczytu z bufora
        if (null === $widgetData = \App\Registry::$cache->load($cacheKey = 'category-widget-html-' . $widgetRelation->id)) {
            //pobranie konfiguracji widgetu
            $widgetRequest = $widgetRecord->getMvcParamsAsRequest();
            //ustawienie identyfikatora relacji widgetu
            $widgetRequest->widgetId = $widgetRelation->id;
            //render widgetu
            $widgetData = \Mmi\Mvc\ActionHelper::getInstance()->action($widgetRequest);
            //bufor wyłączony parametrem
            if ($widgetRecord->cacheLifetime) {
                //zapis do bufora (czas określony parametrem)
                \App\Registry::$cache->save($widgetData, $cacheKey, $widgetRecord->cacheLifetime);
            }
        }
        //relacja do widoku
        $this->view->_widgetRelation = $widgetRelation;
        //dane html do widoku
        $this->view->_widgetData = $widgetData;
        //render szablonu
        return \Mmi\App\FrontController::getInstance()->getView()->renderTemplate(static::TEMPLATE);
    }
524360
private function _scalarValueByAttribute(\Cms\Orm\CmsAttributeRecord $attribute)
    {
        //iteracja po wartościach
        foreach ($this->_cmsAttributeValues as $valueRecord) {
            //znaleziony atrybut
            if ($valueRecord->cmsAttributeId == $attribute->id) {
                //zwrot wartości
                return $valueRecord->value;
            }
        }
        return $attribute->getJoined('cms_attribute_value')->value;
    }
941074
private final function loadAcl(): void
    {
        $this->acl = new Acl($this);

        $rules = $this->config->get('acl.rules');
        if ($rules != null) {
            $this->acl->setRules($rules);
        }
    }
74679
public function assert(
        Acl $acl,
        RoleInterface $role = null,
        ResourceInterface $resource = null,
        $privilege = null
    ) {
        if (!$role instanceof UserInterface || !$resource instanceof ApplicationInterface) {
            return false;
        }

        /* @var $resource ApplicationInterface|DraftableEntityInterface */

        $permissions = $resource->getPermissions();

        /* If application is a draft, only the associated user may view and edit.
         * As an anonymous user is not saved with the entity, we need to check the 'change' permission.
         */
        if ($resource->isDraft()) {
            return $role === $resource->getUser() || $permissions->isGranted($role, PermissionsInterface::PERMISSION_CHANGE);
        }

        if (ApplicationInterface::PERMISSION_SUBSEQUENT_ATTACHMENT_UPLOAD == $privilege) {
            // only applicant is allowed to upload subsequent attachments
            return $permissions->isAssigned($role) && $permissions->isGranted($role, PermissionsInterface::PERMISSION_VIEW);
        }
        
        $permission = 'read' == $privilege ? PermissionsInterface::PERMISSION_VIEW : PermissionsInterface::PERMISSION_CHANGE;
        return $permissions->isGranted($role, $permission);
    }