Example #1
0
 /**
  * Load route rules
  */
 private function loadRouteRules()
 {
     foreach ($this->rules['routeRules'] as $routeAlias => $routeRuleSets) {
         $resourceId = call_user_func_array($this->config['routeResourceGenerator'], [$routeAlias]);
         $this->acl->addResource(new Resource($resourceId));
         foreach ($routeRuleSets as $ruleSet) {
             $this->enforceRuleset($ruleSet, ['resources' => $resourceId, 'privileges' => $this->config['routePrivilege']]);
         }
     }
 }
Example #2
0
 /**
  * @inheritdocs
  */
 protected function getContextFromAuth(Model $modelObject = null)
 {
     $authSubject = $this->getGuard()->user();
     if ($authSubject instanceof UserModel) {
         return new UserContext($authSubject, $modelObject);
     }
     if ($authSubject instanceof ClientModel) {
         return new ClientContext($authSubject, $modelObject);
     }
     return parent::getContextFromAuth($modelObject);
 }