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:
@@ -13,6 +13,10 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return true;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,6 +25,10 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function view(User $user, Application $application): bool
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return true;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,11 +37,15 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,11 +53,15 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function update(User $user, Application $application): Response
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
if ($user->isAdmin()) {
|
||||
return Response::allow();
|
||||
}
|
||||
|
||||
return Response::deny('As a member, you cannot update this application.<br/><br/>You need at least admin or owner permissions.');
|
||||
*/
|
||||
return Response::allow();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,11 +69,15 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function delete(User $user, Application $application): bool
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,6 +85,10 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function restore(User $user, Application $application): bool
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return true;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,7 +97,11 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function forceDelete(User $user, Application $application): bool
|
||||
{
|
||||
return $user->isAdmin() && $user->teams()->get()->firstWhere('id', $application->team()->first()->id) !== null;
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return $user->isAdmin() && $user->teams->contains('id', $application->team()->first()->id);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +109,11 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function deploy(User $user, Application $application): bool
|
||||
{
|
||||
return $user->teams()->get()->firstWhere('id', $application->team()->first()->id) !== null;
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return $user->teams->contains('id', $application->team()->first()->id);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +121,11 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function manageDeployments(User $user, Application $application): bool
|
||||
{
|
||||
return $user->isAdmin() && $user->teams()->get()->firstWhere('id', $application->team()->first()->id) !== null;
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return $user->isAdmin() && $user->teams->contains('id', $application->team()->first()->id);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +133,11 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function manageEnvironment(User $user, Application $application): bool
|
||||
{
|
||||
return $user->isAdmin() && $user->teams()->get()->firstWhere('id', $application->team()->first()->id) !== null;
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return $user->isAdmin() && $user->teams->contains('id', $application->team()->first()->id);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +145,10 @@ class ApplicationPolicy
|
||||
*/
|
||||
public function cleanupDeploymentQueue(User $user): bool
|
||||
{
|
||||
// Authorization temporarily disabled
|
||||
/*
|
||||
return $user->isAdmin();
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user