Skip to content

#3: Permissions#17

Open
patrickfweston wants to merge 8 commits intomasterfrom
issue-3-permisions
Open

#3: Permissions#17
patrickfweston wants to merge 8 commits intomasterfrom
issue-3-permisions

Conversation

@patrickfweston
Copy link
Copy Markdown
Owner

@patrickfweston patrickfweston commented Feb 19, 2018

To test:

  1. Uninstall the module: drush pm-uninstall workbench_reviewer -y
  2. Install the module: drush en workbench_reviewer -y
  3. Create a new role
  4. Grant the new role enough permissions so they can edit content, etc.
  5. Under "Workbench Reviewer", grant them Be assigned Workbench Reviewer and Assign Workbench Reviewer.
  6. Create a user of that role and log in as that user.
  7. Create a node. You should see the workbench reviewer field.
  8. Try entering admin and your user name. Both should be allowable options.
  9. Change the permission for that role by unchecking Be assigned Workbench Reviewer.
  10. Your username should no longer be an option in the box.
  11. Change the permission for that role by unchecking Assign Workbench Reviewer.
  12. You should no longer see the reviewer field.

Note:
Once the module becomes more stable, update hooks will be used instead of uninstalling/installing the module.

title: 'Be assigned Workbench Reviewer'
description: 'Users with this permissions may be assigned content to review via <em>Workbench Reviewer</em>.'
restrict access: FALSE
administer workbench reviewer:
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused at the moment, but will be used later when there are more Workbench Reviewer options / configuration.

Copy link
Copy Markdown
Collaborator

@agentrickard agentrickard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions part looks solid. The rest is best practice cleanup.

),
))
->setSetting('target_type', 'user');
->setSettings(array(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can/should use short array syntax now [ ];.

}

function workbench_reviewer_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
if ($field_definition->getName() == 'workbench_reviewer' && $operation == 'edit') {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be safer to make worbench_reviewer a constant, something like const WORKBENCH_REVIEWER_FIELD = 'workbench_reviewer'; That makes it easier to track (similar to how SASS uses vars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants