/** * Authorize the tree. * * @param TreeBuilder $builder */ public function authorize(TreeBuilder $builder) { // Try the option first. $permission = $builder->getTreeOption('permission'); /* * If the option is not set then * try and automate the permission. */ if (!$permission && ($module = $this->modules->active()) && ($stream = $builder->getTreeStream())) { $permission = $module->getNamespace($stream->getSlug() . '.read'); } if (!$this->authorizer->authorize($permission)) { abort(403); } }