Skip to content

Commit

Permalink
Merge branch 'develop' into feature/advising-1003-enforce-license-rul…
Browse files Browse the repository at this point in the history
…es-forms
  • Loading branch information
mxm1070 authored Dec 14, 2023
2 parents f8bd1b1 + fc6e8e5 commit 3731175
Show file tree
Hide file tree
Showing 107 changed files with 7,585 additions and 2,812 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ app-modules/**/vendor
app-modules/**/resources/js/dist/*
/.phpactor.json
**/.DS_Store
public/api-docs/*
/_lighthouse_ide_helper.php
/programmatic-types.graphql
/schema-directives.graphql
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resources/views/vendor/mail/**/*.blade.php
resources/views/mail/**/*.blade.php
resources/lang/**/*.php
**/vendor
**/vendor
app-modules/notifications/graphql/notifications.graphql
5 changes: 4 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"options": {
"tabWidth": 4
}
}
},
{
"files": ["*.graphql"]
}
]
}
30 changes: 15 additions & 15 deletions app-modules/alert/src/Policies/AlertPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,63 @@

namespace AdvisingApp\Alert\Policies;

use App\Models\User;
use App\Models\Authenticatable;
use AdvisingApp\Alert\Models\Alert;
use Illuminate\Auth\Access\Response;

class AlertPolicy
{
public function viewAny(User $user): Response
public function viewAny(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'alert.view-any',
denyResponse: 'You do not have permission to view alerts.'
);
}

public function view(User $user, Alert $alert): Response
public function view(Authenticatable $authenticatable, Alert $alert): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['alert.*.view', "alert.{$alert->id}.view"],
denyResponse: 'You do not have permission to view this alert.'
);
}

public function create(User $user): Response
public function create(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'alert.create',
denyResponse: 'You do not have permission to create alerts.'
);
}

public function update(User $user, Alert $alert): Response
public function update(Authenticatable $authenticatable, Alert $alert): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['alert.*.update', "alert.{$alert->id}.update"],
denyResponse: 'You do not have permission to update this alert.'
);
}

public function delete(User $user, Alert $alert): Response
public function delete(Authenticatable $authenticatable, Alert $alert): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['alert.*.delete', "alert.{$alert->id}.delete"],
denyResponse: 'You do not have permission to delete this alert.'
);
}

public function restore(User $user, Alert $alert): Response
public function restore(Authenticatable $authenticatable, Alert $alert): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['alert.*.restore', "alert.{$alert->id}.restore"],
denyResponse: 'You do not have permission to restore this alert.'
);
}

public function forceDelete(User $user, Alert $alert): Response
public function forceDelete(Authenticatable $authenticatable, Alert $alert): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['alert.*.force-delete', "alert.{$alert->id}.force-delete"],
denyResponse: 'You do not have permission to permanently delete this alert.'
);
Expand Down
30 changes: 15 additions & 15 deletions app-modules/application/src/Policies/ApplicationPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

namespace AdvisingApp\Application\Policies;

use App\Models\User;
use App\Enums\Feature;
use App\Models\Authenticatable;
use Illuminate\Auth\Access\Response;
use AdvisingApp\Application\Models\Application;
use App\Concerns\FeatureAccessEnforcedPolicyBefore;
Expand All @@ -47,57 +47,57 @@ class ApplicationPolicy implements FeatureAccessEnforcedPolicy
{
use FeatureAccessEnforcedPolicyBefore;

public function viewAny(User $user): Response
public function viewAny(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'application.view-any',
denyResponse: 'You do not have permission to view applications.'
);
}

public function view(User $user, Application $application): Response
public function view(Authenticatable $authenticatable, Application $application): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['application.*.view', "application.{$application->id}.view"],
denyResponse: 'You do not have permission to view this application.'
);
}

public function create(User $user): Response
public function create(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'application.create',
denyResponse: 'You do not have permission to create applications.'
);
}

public function update(User $user, Application $application): Response
public function update(Authenticatable $authenticatable, Application $application): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['application.*.update', "application.{$application->id}.update"],
denyResponse: 'You do not have permission to update this application.'
);
}

public function delete(User $user, Application $application): Response
public function delete(Authenticatable $authenticatable, Application $application): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['application.*.delete', "application.{$application->id}.delete"],
denyResponse: 'You do not have permission to delete this application.'
);
}

public function restore(User $user, Application $application): Response
public function restore(Authenticatable $authenticatable, Application $application): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['application.*.restore', "application.{$application->id}.restore"],
denyResponse: 'You do not have permission to restore this application.'
);
}

public function forceDelete(User $user, Application $application): Response
public function forceDelete(Authenticatable $authenticatable, Application $application): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['application.*.force-delete', "application.{$application->id}.force-delete"],
denyResponse: 'You do not have permission to permanently delete this application.'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

namespace AdvisingApp\Assistant\Policies;

use App\Models\User;
use App\Enums\Feature;
use App\Models\Authenticatable;
use Illuminate\Auth\Access\Response;
use App\Concerns\FeatureAccessEnforcedPolicyBefore;
use App\Policies\Contracts\FeatureAccessEnforcedPolicy;
Expand All @@ -47,43 +47,43 @@ class AssistantChatMessageLogPolicy implements FeatureAccessEnforcedPolicy
{
use FeatureAccessEnforcedPolicyBefore;

public function viewAny(User $user): Response
public function viewAny(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'assistant_chat_message_log.view-any',
denyResponse: 'You do not have permission to view assistant chat message logs.'
);
}

public function view(User $user, AssistantChatMessageLog $assistantChatMessageLog): Response
public function view(Authenticatable $authenticatable, AssistantChatMessageLog $assistantChatMessageLog): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['assistant_chat_message_log.*.view', "assistant_chat_message_log.{$assistantChatMessageLog->id}.view"],
denyResponse: 'You do not have permission to view this assistant chat message log.'
);
}

public function create(User $user): Response
public function create(Authenticatable $authenticatable): Response
{
return Response::deny('Assistant chat message logs cannot be created.');
}

public function update(User $user, AssistantChatMessageLog $assistantChatMessageLog): Response
public function update(Authenticatable $authenticatable, AssistantChatMessageLog $assistantChatMessageLog): Response
{
return Response::deny('Assistant chat message logs cannot be updated.');
}

public function delete(User $user, AssistantChatMessageLog $assistantChatMessageLog): Response
public function delete(Authenticatable $authenticatable, AssistantChatMessageLog $assistantChatMessageLog): Response
{
return Response::deny('Assistant chat message logs cannot be deleted.');
}

public function restore(User $user, AssistantChatMessageLog $assistantChatMessageLog): Response
public function restore(Authenticatable $authenticatable, AssistantChatMessageLog $assistantChatMessageLog): Response
{
return Response::deny('Assistant chat message logs cannot be restored.');
}

public function forceDelete(User $user, AssistantChatMessageLog $assistantChatMessageLog): Response
public function forceDelete(Authenticatable $authenticatable, AssistantChatMessageLog $assistantChatMessageLog): Response
{
return Response::deny('Assistant chat message logs cannot be force deleted.');
}
Expand Down
30 changes: 15 additions & 15 deletions app-modules/audit/src/Policies/AuditPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,63 @@

namespace AdvisingApp\Audit\Policies;

use App\Models\User;
use App\Models\Authenticatable;
use AdvisingApp\Audit\Models\Audit;
use Illuminate\Auth\Access\Response;

class AuditPolicy
{
public function viewAny(User $user): Response
public function viewAny(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'audit.view-any',
denyResponse: 'You do not have permission to view audits.'
);
}

public function view(User $user, Audit $audit): Response
public function view(Authenticatable $authenticatable, Audit $audit): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['audit.*.view', "audit.{$audit->id}.view"],
denyResponse: 'You do not have permission to view this audit.'
);
}

public function create(User $user): Response
public function create(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'audit.create',
denyResponse: 'You do not have permission to create audits.'
);
}

public function update(User $user, Audit $audit): Response
public function update(Authenticatable $authenticatable, Audit $audit): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['audit.*.update', "audit.{$audit->id}.update"],
denyResponse: 'You do not have permission to update this audit.'
);
}

public function delete(User $user, Audit $audit): Response
public function delete(Authenticatable $authenticatable, Audit $audit): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['audit.*.delete', "audit.{$audit->id}.delete"],
denyResponse: 'You do not have permission to delete this audit.'
);
}

public function restore(User $user, Audit $audit): Response
public function restore(Authenticatable $authenticatable, Audit $audit): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['audit.*.restore', "audit.{$audit->id}.restore"],
denyResponse: 'You do not have permission to restore this audit.'
);
}

public function forceDelete(User $user, Audit $audit): Response
public function forceDelete(Authenticatable $authenticatable, Audit $audit): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['audit.*.force-delete', "audit.{$audit->id}.force-delete"],
denyResponse: 'You do not have permission to force delete this audit.'
);
Expand Down
20 changes: 10 additions & 10 deletions app-modules/authorization/src/Policies/PermissionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,49 +36,49 @@

namespace AdvisingApp\Authorization\Policies;

use App\Models\User;
use App\Models\Authenticatable;
use Illuminate\Auth\Access\Response;
use AdvisingApp\Authorization\Models\Permission;

class PermissionPolicy
{
public function viewAny(User $user): Response
public function viewAny(Authenticatable $authenticatable): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: 'permission.view-any',
denyResponse: 'You do not have permission to view permissions.'
);
}

public function view(User $user, Permission $permission): Response
public function view(Authenticatable $authenticatable, Permission $permission): Response
{
return $user->canOrElse(
return $authenticatable->canOrElse(
abilities: ['permission.*.view', "permission.{$permission->id}.view"],
denyResponse: 'You do not have permission to view this permission.'
);
}

public function create(User $user): Response
public function create(Authenticatable $authenticatable): Response
{
return Response::deny('Permissions cannot be created.');
}

public function update(User $user, Permission $permission): Response
public function update(Authenticatable $authenticatable, Permission $permission): Response
{
return Response::deny('Permissions cannot be updated.');
}

public function delete(User $user, Permission $permission): Response
public function delete(Authenticatable $authenticatable, Permission $permission): Response
{
return Response::deny('Permissions cannot be deleted.');
}

public function restore(User $user, Permission $permission): Response
public function restore(Authenticatable $authenticatable, Permission $permission): Response
{
return Response::deny('Permissions cannot be restored.');
}

public function forceDelete(User $user, Permission $permission): Response
public function forceDelete(Authenticatable $authenticatable, Permission $permission): Response
{
return Response::deny('Permissions cannot be force deleted.');
}
Expand Down
Loading

0 comments on commit 3731175

Please sign in to comment.