Exemplo n.º 1
0
 /**
  * Loads access scope.
  *
  * @return void
  */
 protected function loadAccessibilityScope()
 {
     parent::loadAccessibilityScope();
     $this->scope = array('permissions' => Helpers\CMSUsers::getAccessibilityScope(), 'ownership' => Helpers\Ownership::getScope($this->modules));
 }
Exemplo n.º 2
0
 /**
  * Prevents Association of not owned resource.
  *
  * @param \Core\Modules\Router\Request $request Request object.
  *
  * @return void
  */
 private function preventAssociationOfNotOwnedResource(Request $request)
 {
     foreach ($this->attributes as $attribute => $options) {
         if ($request->post($attribute)) {
             $association = $this->resource->getAssociationMetaDataByKey($attribute);
             if (!$association && isset($this->resource->hasAndBelongsToMany[$attribute])) {
                 $association = $this->resource->hasAndBelongsToMany[$attribute];
             }
             if ($association && $this->user->owns($association['class_name'])) {
                 if (!Helpers\Ownership::checkIds($request->post($attribute), $association['class_name'])) {
                     $this->resource->setError($attribute, 'not_exists');
                 }
             }
         }
     }
 }