-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: [metafield editor permission] added
- users/org admins/group admins/community admins can now only modify metafield data on any object if the permission is set for their role - Since some communities use this for ACL to secondary tools, this will allow them to restrict who can modify them
- Loading branch information
Showing
4 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
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,30 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use Migrations\AbstractMigration; | ||
use Phinx\Db\Adapter\MysqlAdapter; | ||
|
||
final class RoleMetaEditor extends AbstractMigration | ||
{ | ||
public $autoId = false; // turn off automatic `id` column create. We want it to be `int(10) unsigned` | ||
|
||
public function change(): void | ||
{ | ||
$exists = $this->table('roles')->hasColumn('perm_meta_field_editor'); | ||
if (!$exists) { | ||
$this->table('roles') | ||
->addColumn('perm_meta_field_editor', 'boolean', [ | ||
'default' => 0, | ||
'null' => false, | ||
]) | ||
->addIndex('perm_meta_field_editor') | ||
->update(); | ||
} | ||
$builder = $this->getQueryBuilder(); | ||
$builder | ||
->update('roles') | ||
->set('perm_meta_field_editor', true) | ||
->where(['perm_admin' => true]) | ||
->execute(); | ||
} | ||
} |
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
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