Esempio n. 1
0
 protected function load($select = array(), $with = array())
 {
     $map_model_repos = array('tag' => 'tags', 'thread' => 'threads', 'post' => 'posts');
     $map_route_models = array('forum.get.view.tag' => 'tag', 'forum.get.create.thread' => 'tag', 'forum.get.view.thread' => 'thread', 'forum.post.lock.thread' => 'thread', 'forum.delete.thread' => 'thread', 'forum.get.edit.post' => 'post', 'forum.delete.post' => 'post');
     $map_route_permissions = array('forum.get.view.tag' => 'access_tag', 'forum.get.create.thread' => 'create_threads', 'forum.get.view.thread' => 'access_tag', 'forum.post.lock.thread' => 'lock_threads', 'forum.delete.thread' => 'delete_threads', 'forum.get.edit.post' => 'edit_post', 'forum.delete.post' => 'delete_posts');
     $route_name = Route::current()->getName();
     foreach ($select as $model => $id) {
         $this->collections[$model] = $this->{$map_model_repos}[$model]->getByID($id, $with);
         if (isset($map_route_permissions[$route_name]) && $model == $map_route_models[$route_name]) {
             AccessControl::check($this->collections[$model], $map_route_permissions[$route_name]);
         }
     }
     $this->check404();
 }
Esempio n. 2
0
 public function getUserCanDeleteAttribute()
 {
     return AccessControl::check($this, 'delete_threads', false);
 }