Skip to content
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

Replace node_access_strict so it works with all entity types #271

Open
pfrenssen opened this issue Jul 28, 2016 · 2 comments
Open

Replace node_access_strict so it works with all entity types #271

pfrenssen opened this issue Jul 28, 2016 · 2 comments

Comments

@pfrenssen
Copy link
Collaborator

In our project we have a 'site moderator' role which can create, edit and delete any group content regardless whether they are a member of the group or not.

It would be ideal to use the node_access_strict option for this, but our group content does not only consist of nodes, we are using different entity types.

Can we change node_access_strict to something like strict_access and don't restrict it to nodes only?

@idimopoulos
Copy link

Just as a primal thought, since we are handling users in a special way in OG, maybe this option should still exclude users (if they are group content?).

@idimopoulos
Copy link

idimopoulos commented Jul 28, 2016

I have done a little testing on this. It seems to work fine for update/delete operations if we do the following

--- a/og.module
+++ b/og.module
@@ -132,7 +132,7 @@ function og_entity_access(EntityInterface $entity, $operation, AccountInterface
return $access;
}

  • if ($entity_type_id == 'node') {

  • if ($entity_type_id != 'user') {
    $node_access_strict = \Drupal::config('og.settings')->get('node_access_strict');

    // Otherwise, ignore or deny based on whether strict node access is set.

but the create is a bit more tricky as the hooks are called after the access handlers and there is no clue on what is the status till then.
Still, even with this, in our project, we have created some forms so that the user does not create the bundle test through 'node/add/test' but through '<entity_type>//test/add' and we are providing custom access.
In this access we have to exclusively also check for the node_access_strict because it does not go through the hooking system. This is why I think it is better that this issue is implemented along with
#272

amitaibu added a commit that referenced this issue May 28, 2017
Introduce OgMembershipInterface::revokeRoleById()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants