forked from ushahidi/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
return all permissions for admin role
- Loading branch information
Showing
3 changed files
with
103 additions
and
16 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
database/migrations/phinx/20240213065807_add_missing_admin_permissions.php
This file contains 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,65 @@ | ||
<?php | ||
|
||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class AddMissingAdminPermissions extends AbstractMigration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Manage Users')"); | ||
|
||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Manage Posts')"); | ||
|
||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Manage Settings')"); | ||
|
||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Bulk Data Import and Export')"); | ||
|
||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Edit their own posts')"); | ||
|
||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Delete Posts')"); | ||
|
||
$this->execute("INSERT INTO `roles_permissions` (`role`, `permission`) | ||
VALUES ('admin', 'Delete Their Own Posts')"); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Manage Users'"); | ||
|
||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Manage Posts'"); | ||
|
||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Manage Settings'"); | ||
|
||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Bulk Data Import and Export'"); | ||
|
||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Edit their own posts'"); | ||
|
||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Delete Posts'"); | ||
|
||
$this->execute("DELETE FROM roles_permissions | ||
WHERE permission = 'Delete Their Own Posts'"); | ||
} | ||
} |
This file contains 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
This file contains 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