-
Notifications
You must be signed in to change notification settings - Fork 246
FOUR-20443: The permission "View All Cases" and "View My Request" are not showing #7758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 0 additions & 25 deletions
25
database/seeders/RenameRequestsToCasesPermissionSeeder.php
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
upgrades/2024_11_19_161132_create_permission_view_all_cases_all_requests.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <?php | ||
|
|
||
| use ProcessMaker\Models\Permission; | ||
| use ProcessMaker\Upgrades\UpgradeMigration as Upgrade; | ||
|
|
||
| class CreatePermissionViewAllCasesAllRequests extends Upgrade | ||
| { | ||
| private const NEW_NAME_GROUP = 'Cases and Requests'; | ||
|
|
||
| private const PERMISSIONS = [ | ||
| [ | ||
| 'name' => 'view-all_cases', | ||
| 'title' => 'View All Cases', | ||
| ], | ||
| [ | ||
| 'name' => 'view-my_requests', | ||
| 'title' => 'View My Requests', | ||
| ], | ||
| ]; | ||
|
|
||
| /** | ||
| * Run the migrations. | ||
| */ | ||
| public function up(): void | ||
| { | ||
| // Update the group Requests to Cases and Requests | ||
| DB::table('permissions') | ||
| ->where('group', 'Requests') | ||
| ->update(['group' => self::NEW_NAME_GROUP]); | ||
| // Update the group Cases to Cases and Requests | ||
| DB::table('permissions') | ||
| ->where('group', 'Cases') | ||
| ->update(['group' => self::NEW_NAME_GROUP]); | ||
| // Update with the correct label "View All Request" | ||
| // Summer 2024: PO requested change to "View All Cases" | ||
| // Fall 2024: PO requested revert to "View All Request" | ||
| $permission = Permission::where('name', 'view-all_requests')->first(); | ||
| if ($permission && $permission->title == 'View All Cases') { | ||
| $permission->title = 'View All Request'; | ||
| $permission->save(); | ||
| } | ||
| // Create new permissions [view-all_cases, view-all_requests] | ||
| $this->createPermissions(); | ||
| } | ||
|
|
||
| /** | ||
| * Create new permissions | ||
| * | ||
| * @return void | ||
| */ | ||
| private function createPermissions(): void | ||
| { | ||
| foreach (self::PERMISSIONS as $permission) { | ||
| Permission::updateOrCreate([ | ||
| 'name' => $permission['name'], | ||
| ], [ | ||
| 'title' => $permission['title'], | ||
| 'name' => $permission['name'], | ||
| 'group' => self::NEW_NAME_GROUP, | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| */ | ||
| public function down(): void | ||
| { | ||
| Permission::where('name', 'view-all_cases')->delete(); | ||
| Permission::where('name', 'view-my_requests')->delete(); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.