src/action/PermissionsAction.php
public function run(Request $request) {
		$user = $this->getServiceContainer()->getAuthManager()->getUser();
		
		// always allow what guests can do
		$guestGroup = GroupQuery::create()->findOneByIsGuest(true);
		
		// collect groups from user
		$groups = GroupQuery::create()->filterByUser($user)->find();
		$userGroup = GroupQuery::create()->filterByOwnerId($user->getId())->findOne();
		if ($userGroup) {
			$groups[] = $userGroup;
		}
		$groups[] = $guestGroup;
		
		// ... structure them
		$permissions = [];
		foreach ($groups as $group) {
			foreach ($group->getActions() as $action) {
				$moduleName = $action->getModule()->getName();
				if (!isset($permissions[$moduleName])) {
					$permissions[$moduleName] = [];
				}
				$permissions[$moduleName][] = $action->getName();
			}
		}

		return $this->responder->run($request, new Found(['permissions' => $permissions]));
	}
public function run(Request $request) {
		$user = $this->getServiceContainer()->getAuthManager()->getUser();
		
		// always allow what guests can do
		$guestGroup = GroupQuery::create()->findOneByIsGuest(true);
		
		// collect groups from user
		$groups = GroupQuery::create()->filterByUser($user)->find();
		$userGroup = GroupQuery::create()->filterByOwnerId($user->getId())->findOne();
		if ($userGroup) {
			$groups[] = $userGroup;
		}
		$groups[] = $guestGroup;
		
		// ... structure them
		$permissions = [];
		foreach ($groups as $group) {
			foreach ($group->getActions() as $action) {
				$moduleName = $action->getModule()->getName();
				if (!isset($permissions[$moduleName])) {
					$permissions[$moduleName] = [];
				}
				$permissions[$moduleName][] = $action->getName();
			}
		}

		return $this->responder->run($request, new Found(['permissions' => $permissions]));
	}
Automatically generated run method

@param Request $request
@return Response