Skip to content

Instantly share code, notes, and snippets.

@dasginganinja
Created October 31, 2018 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasginganinja/b4e049d858339098452c0d453ce0c982 to your computer and use it in GitHub Desktop.
Save dasginganinja/b4e049d858339098452c0d453ce0c982 to your computer and use it in GitHub Desktop.
OG role override -- rule replacement
The rule I created to make this works is configured as follows:
-- Event: After updating an existing user account
-- Conditions: User has role(s)
-- -- Parameter: User: data selector: [account], Roles: value: story author override {this is a drupal role I created for this purpose},
-- -- -- Match Roles: "if matching against all selected roles, the user must have ALL the roles selected"
-- -- -- Negate is not checked
-- Elements:
-- -- fetch entity by id:
-- -- -- Parameter: Entity type: Node, Identifier: 1
-- -- -- Provides variables: Fetched entity (entity_fetched)
-- -- Fetch entity by property
-- -- -- Parameter: Entity type: Node, Property: Group, Value: True { Group }
-- -- -- Provided variables: Label: Fetched groups, name: entity_fetched_groups
-- -- -- Loop
-- -- -- -- -- Parameter: List: Data selector: entity-fetched-groups
-- -- -- -- -- Current List item: group in list, variable name: list_item
-- -- -- -- Subscribe user to group
-- -- -- -- -- Parameter: User: data selector: account, Group: data selector: list-item
-- -- -- -- Grant OG role
-- -- -- -- -- Parameter: User: data selector: account, Group: data selector: list-item, Group Roles: value: story author {an OG role I created for this purpose}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment