Posted by wjaspers on February 13, 2012 at 3:03am
5 followers
Jump to:
| Project: | Masquerade |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Just curious if Rules support is in the works anywhere.
Possible Conditions:
* Is Masquerading?
Possible Events:
* Began Masquerade-ing
* Stopped Masquerade-ing
Possible Actions:
* Start Masquerade-ing
* Stop Masquerade-ing
* Stop All Masquerade-ing
Comments
#1
This would be an extremely valuable feature to add!
#2
This request would depend on:
#1458418: Add masquerade events API
And therefore, this request had already been moved to (somehow I forgot about this post):
#1458334: Add Rules support
#3
I don't think we need an events API to support Rules. Rules is popular enough to get bumped ahead of a generic API integration if someone submitted a patch for it.
#4
Then, for example, the implementation of capturing when a user is about to masquerade would be:
<?phpif (module_exists('rules')) {
// rules_invoke_event(<event_id>, <current_user>, <new_user>)
rules_invoke_event('masquerade_X', $user, $account);
}
?>
I thought initially about going down this road, but it feels too tightly coupled.
Plus, in further thought, we could let other modules stop the masquerade based on custom requirements.
<?php$roll_with_it = TRUE;
if (module_exists('rules')) {
// rules_invoke_event(<event_id>, <current_user>, <new_user>, <permit_masquerade>)
rules_invoke_event('masquerade_X', $user, $account, $roll_with_it);
}
if (!$roll_with_it) {
// Do something to let the user know the masquerade wasn't permitted.
}
?>
#5
let's continue in this issue, marked as dumplicated #1458334: Add Rules support
suppose we just need to implement support in masquerade.rules.inc