feat(acl): Change views/backend code to able to use proper ACL's later on. Currently it is not enabled.
This commit is contained in:
@@ -28,7 +28,8 @@ class ServicePolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->isAdmin();
|
||||
// return $user->isAdmin();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +37,13 @@ class ServicePolicy
|
||||
*/
|
||||
public function update(User $user, Service $service): bool
|
||||
{
|
||||
return $user->isAdmin() && $user->teams()->get()->firstWhere('id', $service->team()->first()->id) !== null;
|
||||
$team = $service->team();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return $user->isAdmin() && $user->teams->contains('id', $team->id);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,11 +51,12 @@ class ServicePolicy
|
||||
*/
|
||||
public function delete(User $user, Service $service): bool
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
// if ($user->isAdmin()) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
return false;
|
||||
// return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,6 +64,7 @@ class ServicePolicy
|
||||
*/
|
||||
public function restore(User $user, Service $service): bool
|
||||
{
|
||||
// return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,16 +73,23 @@ class ServicePolicy
|
||||
*/
|
||||
public function forceDelete(User $user, Service $service): bool
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
// if ($user->isAdmin()) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
return false;
|
||||
// return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function stop(User $user, Service $service): bool
|
||||
{
|
||||
return $user->teams()->get()->firstWhere('id', $service->team()->first()->id) !== null;
|
||||
$team = $service->team();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return $user->teams->contains('id', $team->id);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +97,13 @@ class ServicePolicy
|
||||
*/
|
||||
public function manageEnvironment(User $user, Service $service): bool
|
||||
{
|
||||
return $user->isAdmin() && $user->teams()->get()->firstWhere('id', $service->team()->first()->id) !== null;
|
||||
$team = $service->team();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return $user->isAdmin() && $user->teams->contains('id', $team->id);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,6 +111,18 @@ class ServicePolicy
|
||||
*/
|
||||
public function deploy(User $user, Service $service): bool
|
||||
{
|
||||
return $user->teams()->get()->firstWhere('id', $service->team()->first()->id) !== null;
|
||||
$team = $service->team();
|
||||
if (! $team) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return $user->teams->contains('id', $team->id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function accessTerminal(User $user, Service $service): bool
|
||||
{
|
||||
// return $user->isAdmin() || $user->teams->contains('id', $service->team()->id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user