Retrieve the manage view for a block

@param string  $owner
@param integer $ownerId
@param integer $id

@return JsonResponse
554341
public function viewBlockAction($owner, $ownerId, $id)
    {
        /** @var BlockManager $manager */
        $manager = $this->get('opifer.content.block_manager');

        $object = $this->get('opifer.content.block_provider_pool')->getProvider($owner)->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);

        $block = $environment->getBlock($id);

        $environment->setBlockMode(Environment::MODE_MANAGE);

        /** @var AbstractBlockService $service */
        $service = $manager->getService($block);
        $service->setEnvironment($environment);

        $this->get('opifer.content.twig.content_extension')->setBlockEnvironment($environment);


        return new JsonResponse(['view' => $service->manage($block)->getContent()]);
    }
76479
private function menuBranch($owner = 0, $level = 0)
    {
        $result = array(array(), array());
        $items = Eresus_CMS::getLegacyKernel()->db->select('pages',
            "(`access` >= '" . USER . "') AND (`owner` = '" . $owner . "') AND (`active` = '1')",
            "-position", "`id`,`caption`");
        if (count($items))
        {
            foreach ($items as $item)
            {
                $result[0][] = str_repeat('- ', $level) . $item['caption'];
                $result[1][] = $item['id'];
                $sub = $this->menuBranch($item['id'], $level + 1);
                if (count($sub[0]))
                {
                    $result[0] = array_merge($result[0], $sub[0]);
                    $result[1] = array_merge($result[1], $sub[1]);
                }
            }
        }
        return $result;
    }
172011
public function show($id)
    {
        // get permission by id
        $permission = Permission::find($id);

        if (!$permission) {
            return response()->json(null, 404);
        }

        return response()->json(arrayView('phpsoft.users::permission/read', [
            'permission' => $permission
        ]), 200);
    }
881018
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->getOAuth()->getAuthServer()
          ->getGrantType('authorization_code')
          ->newAuthoriseRequest($owner, $owner_id, $options);
  }
6050
public function callMiddleware($id, $owner)
    {
        if ($owner->freezed) {
            return $owner;
        }

        $class = get_class($owner);
        foreach ($owner->middleware as $definition) {
            $middleware = make($definition);
            if (!$middleware instanceof MiddlewareContract) {
                throw new InvalidConfigException(sprintf("'%s' is not a valid middleware", get_class($middleware)));
            }

            $result = $middleware->handle($owner);
            if ($result === false) {
                break;
            } elseif ($result instanceof $class) {
                $owner = $result;
            } elseif ($result !== null) {
                throw new InvalidValueException(sprintf(
                    'The return value of %s::handle() should be one of false, null and %s',
                    get_class($middleware), $class
                ));
            }
        }

        $this->bind($id, $owner, true);
        $owner->freeze();

        return $owner;
    }
1354673
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->authServer->getGrantType('authorization_code')->newAuthoriseRequest($owner, $owner_id, $options);
  }
1064016
public function getList($owner, $repo)
	{
		// Build the request path.
		$path = '/repos/' . $owner . '/' . $repo . '/downloads';

		// Send the request.
		return $this->processResponse(
			$this->client->get($this->fetchUrl($path))
		);
	}
870694
function(ownerId, callback) {
      if (!ownerId) return callback(new Error(utils.i18n.blocklist.ownerId));
      utils.debug('Blocklist get: ' + ownerId);

      request.get({
        path: '/users/' + querystring.escape(ownerId) + '/blocks'
      }, callback);
    }
490376
public function view($id = null) {
		$block = $this->Blocks->get($id, [
			'contain' => []
		]);
		$this->set('block', $block);
	}
446278
public function show($id)
    {
        try
        {
            $throttle = $this->users->getUserThrottle($id);
            $user = $throttle->getUser();
            $permissions = $user->getMergedPermissions();

            return View::make(Config::get('cpanel::views.users_show'))
                ->with('user',$user)
                ->with('groups',$user->getGroups())
                ->with('permissions',$permissions)
                ->with('throttle',$throttle);
        }
        catch ( UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', $e->getMessage());
        }
    }
953198
public function block($id)
    {
        $user = AppUser::find($id);

        if (!$user) {
            return response()->json(null, 404);
        }

        if ($user->isBlock()) {
            return response()->json(null, 204);
        }

        if (!$user->block()) {
            return response()->json(null, 500); // @codeCoverageIgnore
        }

        return response()->json(null, 204);
    }
1073166
public function edit($id)
    {
        $role = Role::findOrFail($id);
        $permissions = Permission::select('id', 'name', 'label')->get()->pluck('label', 'name');

        return view('admin.roles.edit', compact('role', 'permissions'));
    }
331177
public function loadBlock($id)
    {
        $block = $this->entityTypeManager->getStorage('block')->load($id);


        return $block ? $this->entityTypeManager->getViewBuilder('block')->view($block) : '';
    }
518350
public function view($id = null)
    {
        $user = $this->Users->get($id);
        $this->set('user', $user);

        $this->render(Configure::read('CM.AdminUserViews.view'));
    }
1321116
protected function _owner()
    {
        static $owner = false;

        if ( $owner === false )
        {
            $owner = eZUser::fetch( $this->owner_id );
        }

        return $owner;
    }
513308
public function show($id)
    {
        // get permissions and roles of a route by id
        $routePermission = RoutePermission::find($id);

        if (!$routePermission) {
            return response()->json(null, 404);
        }

        return response()->json(arrayView('phpsoft.users::routePermission/read', [
            'routePermission' => $routePermission
        ]), 200);
    }
8383
public function createBlock($owner, $type, $parentId, $placeholder, $sort, $data = null, $draft = true)
    {
        /** @var AbstractBlockService $service */
        $service = $this->getService($type);
        $parent = $parentId ? $this->find($parentId, $draft) : null;

        // This should replaced with a more hardened function
        if (is_null($data)) {
            $data = array();
        }
        $data['owner'] = $owner;

        $block = $service->createBlock($data);

        $block->setPosition($placeholder);
        $block->setSort(0); // < default, gets recalculated later for entire level
        $block->setSortParent(-1); // < need to be calculated when putting in the tree

        // Set owner
        if (is_null($parent) || false === $parent->isShared()) {
            $block->setOwner($owner);
        }

        $block->setParent($parent);

        // Save now, rest will be in changeset. All we do is a create a stub entry anyway.
        $this->save($block, $draft);

        if (count($sort) > 1) {
            // Replace the zero value in the posted sort array
            // with the newly created id to perform sorting
            $id = $block->getId();
            $sort = array_map(
                function ($v) use ($id) {
                    return $v == "" || $v == "0" ? $id : $v;
                },
                $sort
            );

            array_walk($sort, function (&$id) { $id = (int) $id; });
            $contained = $this->findById($sort, $draft);

            if ($contained) {
                $contained = $this->setSortsByDirective($contained, $sort);

                foreach ($contained as $node) {
                    // If nodes are in the same parent and if their owners match we
                    // save the changes. We don't want to save sort changes made to
                    // nodes belonging to inherited trees.
                    if ($node->getParent() === $block->getParent() &&
                        (($node->getOwner() === null && $block->getOwner() === null) ||
                        ($node->getOwner()->getId() == $block->getOwner()->getId()))) {
                        $this->save($node, $draft);
                    }
                }
            }
        }

        return $block;
    }