Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:42:24 +01:00
parent 657262f179
commit 1368aafe5f
23 changed files with 169 additions and 169 deletions

View File

@@ -54,7 +54,7 @@ class DestroyController extends Controller
public function destroy(UserGroup $userGroup): JsonResponse
{
/** @var User $user */
$user = auth()->user();
$user = auth()->user();
// to access this function: must be group owner or sysadmin.
// need owner role or system owner role to delete user group.
$access = $user->hasSpecificRoleInGroup($userGroup, UserRoleEnum::OWNER) || $user->hasRole('owner');

View File

@@ -53,8 +53,8 @@ class ShowController extends Controller
public function index(): JsonResponse
{
$collection = new Collection();
$pageSize = $this->parameters->get('limit');
$collection = new Collection();
$pageSize = $this->parameters->get('limit');
// if the user has the system owner role, get all. Otherwise, get only the users' groups.
if (!auth()->user()->hasRole('owner')) {
$collection = $this->repository->get();
@@ -62,8 +62,8 @@ class ShowController extends Controller
if (auth()->user()->hasRole('owner')) {
$collection = $this->repository->getAll();
}
$count = $collection->count();
$userGroups = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$count = $collection->count();
$userGroups = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($userGroups, $count, $pageSize, $this->parameters->get('page'));
$transformer = new UserGroupTransformer();