Is it possible to have integration with the Rules module? What I have in mind is to give permissions to specific users with a rule after an event occurs.
Example use cases
Event: A student creates a node.
Action: The student's supervisor is granted access to the node.
Event: A user creates a node.
Action: Other users which are friends with the creator (flag friend module) are granted access to the node.
Event: Employee creates a request for his/her manager.
Action: Only the manager assigned as the superior of the employee shall have access to the request.
Event: An editor grants a reviewer access to unpublished content.
Action: An e-mail is sent to the reviewer telling him that he now has access.
Event: There is a feature that allows a user to request to be added to the ACL for a node.
Action: An administrator approves the request. This triggers a rule that the user is granted access, and an email is sent to the user informing him that he is granted access.
Comment | File | Size | Author |
---|---|---|---|
#30 | flexiaccess-rule_integration-1879112-30.patch | 6.2 KB | Jan-E |
#26 | flexiaccess-rule_integration-1879112-26.patch | 6.61 KB | abarpetia |
Comments
Comment #1
gisleThank you for suggesting integration with the Rules module.
My first priority now is to get Flexi Access ready for a stable full release, and I will not work on feature request before that goal is reached. However, I am open for suggestions, and will look again at all suggestions when the stable full release is done.
It will also be useful to know more about what sort of use cases you see for integration with Rules. For example what sort of events do you think will be used to trigger permission changes?
Comment #2
Sinan Erdem CreditAttribution: Sinan Erdem commentedThanks for the reply.
One certain use case is:
Event: A user creates a content.
Action: Other users which are friends with the creator (flag friend module) gain access to content.
Comment #3
gisleThanks for the helpful example/use case.
Postponed until a stable release is done.
Comment #4
gisleA stable release of Flexi Access is now available.
Adding this feature will probably not be done by the maintainer (I am already too busy with other projects). However, I shall review any patches that adds this feature, and include them in the next release if they pass review.
Comment #5
Elin Yordanov CreditAttribution: Elin Yordanov commentedThis feature would be very useful.
Comment #6
radj CreditAttribution: radj commentedAnother user case:
Context: User A created Content Node N but page is visible only to user A by default. User B can make Request Node R to view N.
Event: When User A approves Request R for Node N
Action: Add User B to list of users that can view Node N
This feature would be really helpful!
Comment #7
jojomojo CreditAttribution: jojomojo commentedHi Radj,
Have you found another way of accomplishing your use case, maybe just with the normal ACL module and rules?
If I've found a way to do this, I'll post it here.
Thanks in advance
Comment #8
jojomojo CreditAttribution: jojomojo commentedJust to come back to the issue, I solved this case via Organic Groups. Nodes or other entity permissions can be managed quite nicely with it.
Comment #9
gisleAdded use cases to summary
Comment #10
gisleComment #11
apaferal CreditAttribution: apaferal commentedThere is new news about this feature. It would be very interesting the integration with rules.
Comment #12
gisleAdded another use case.
Comment #13
abarpetia CreditAttribution: abarpetia commentedHello,
Is this use case is implemented?
Event: An editor grants a reviewer access to view content.
Action: An e-mail is sent to the reviewer telling him that he now has access.
Regards,
Abarpetia
Comment #14
gisleabarpetia wrote:
No. None of the use cases listed can be implemented with Flexi Access until it has integration with the rules module.
Comment #15
abarpetia CreditAttribution: abarpetia commentedHello Gisle,
I tried to achieve this use case with rules module but i haven't found any token which will give me email id of person who got access.
Comment #16
gisle@abartetia, this use case is not supported by this module.
The features necessary to implement the use cases are requested. This issue is a feature request, not a manual page.
Comment #17
gisleComment #18
abarpetia CreditAttribution: abarpetia as a volunteer commentedHey guys, I am currently working on this patch. I am trying to implement following use case and have already achieved till triggering rule event after flexi access save (attached patch).
To send out emails to all users who got access to node, I need to provide list of users to rule's send email action set but I am not sure how I can achieve this. So, would appreciate some help here.
Event: An editor grants a reviewer access to view content.
Action: An e-mail is sent to the reviewer telling him that he now has access.
Comment #19
abarpetia CreditAttribution: abarpetia as a volunteer commentedHere is the new patch which is creating grant and revoke rule action. By using this actions, user can able to assign or revoke view/delete/update permissions.
Targeted case study:
Event: A student creates a node.
Action: The student's supervisor is granted access to the node.
Event: A user creates a node.
Action: Other users which are friends with the creator (flag friend module) are granted access to the node.
Event: Employee creates a request for his/her manager.
Action: Only the manager assigned as the superior of the employee shall have access to the request.
I am still working on that email user list(#18).
Comment #20
april26 CreditAttribution: april26 commentedIt would be great to have rules integration. I would like to automatically give the author access to edit the node at least for a short time. Current it looks like I have to identify and add the author as soon as the node is created. Even with the preview, most times they see a minor correction the second they publish!
Comment #21
gisle@april26,
a patch is available.
It would help a lot if you could review the patch in #18 and tell us whether it works for you.
Comment #22
abarpetia CreditAttribution: abarpetia as a volunteer commentedNew patch which support all use cases include the one mentioned in #13. Let me know if there are any issues with this patch.
Target use cases:
Event: A student creates a node.
Action: The student's supervisor is granted access to the node.
Event: A user creates a node.
Action: Other users which are friends with the creator (flag friend module) are granted access to the node.
Event: Employee creates a request for his/her manager.
Action: Only the manager assigned as the superior of the employee shall have access to the request.
Event: An editor grants a reviewer access to view/update/delete content.
Action: An e-mail is sent to the reviewer telling him that he now has access to view/update/delete.
Event: An editor grants a reviewer access to unpublished content.
Action: An e-mail is sent to the reviewer telling him that he now has access.
Patch description:
Event: After updating per node Flexi Access permissions
This event will trigger when user click on "commit updates" button on Node -> FlexiAccess tab.
Actions: "Grant permissions to user" And "Revoke permissions of user"
This actions will allow grant OR revoke view/update/delete permissions.
To access list of users who got view/update/delete access, you'll need to create a loop which will iterate through flexiaccess_view_user_list / flexiaccess_update_user_list / flexiaccess_delete_user_list data selector list.
Comment #23
markpape CreditAttribution: markpape commentedHi abarpetia,
I get this error when adding users:
I added a Rule to execute what you have in #18 and after changing users for a node got this error:
Where is the correct place to report this?
--- UPDATE ---
The above problem was created (by me :( oops!) after moving from flexiaccess 7.x-1.1 to flexiaccess 7.x-1.x-dev without clearing all ACL records in bulk operations: http://www.santheafrica.org/admin/config/people/flexiaccess/bulkop, i reset and deleted.
So far solved my own problem.
Comment #24
markpape CreditAttribution: markpape commentedHi abarpetia,
I am currently able to fulfill the following use case in Rules:
Event: After updating per node Flexi Access permissions
Actions: Email all users notifying them they have been granted access.
How do i ensure only new users in the ACL list are emailed?
Also, How do i implement your initial use case below:
Comment #25
abarpetia CreditAttribution: abarpetia as a volunteer commentedHello Markpape,
It sends out notification to all users in the ACL list. For ex, if test1 is already in list and test2 is new user then It'll send notifications to both test1 and test2.
This patch has "Grant permissions to user" action which you can use to grant access and email to users. Not sure about approval phase though, may be some kind of request form or field.
Comment #26
abarpetia CreditAttribution: abarpetia as a volunteer commentedWhile testing #22 patch got error message "Call to undefined function rules_invoke_event()" because Rules module was not enable. Re-rolled new patch which checks whether rules_invoke_event function is exist or not.
We can also add strict dependency on .info page but I'll prefer to leave this decision on Module maintainer.
@Markpape, If this patch worked for you then please feel free to change RTBC status.
Comment #27
gisleabarpetia wrote:
It is better to check whether the
rules_invoke_event
function is exists.Introducing a hard dependency in
.info
means that users who use this module without requiring integration with Rules would be forced to install the Rules module. We don't want that.Comment #28
Jan-E CreditAttribution: Jan-E commentedNew patch for release 7.x-1.2
Comment #29
Jan-E CreditAttribution: Jan-E commentedMoved more lines into the check on
function_exists('rules_invoke_event')
Comment #30
Jan-E CreditAttribution: Jan-E commentedAnd removed the change to
.info
Comment #31
gisle@Jan-E, thanks for re-rolling the patch for release 7.x-1.2.
To have this committed, we need to have this patch tested by someone who actually uses Rules along with Flexi access.
Comment #32
gisleNobody has stepped forwards to review this for nearly five years, and there don't seem to be much interest. For Drupal 9 and later, the contributed Rules project, seems to lack traction.
I am sorry, but I've decided to not move forwards with this feature request.