Create a custom event handler. The example shows how to catch a global event for an update to a user object. You could do the same with the user role object (or just use the user and check if they are in the role(s) you are looking for).
[CustomClassLoaderModule]
public partial class CMSModuleLoader
{
/// <summary>
/// Summary description for CustomClassLoaderModuleAttribute
/// </summary>
private class CustomClassLoaderModuleAttribute : CMSLoaderAttribute
{
//private UserInfo lastUserInfo;
/// <summary>
/// Initializes the module
/// </summary>
public override void Init()
{
ObjectEvents.Update.SupportsCancel = true;
ObjectEvents.Update.After += Update_After;
}
private void Update_After(object sender, ObjectEventArgs e)
{
switch (e.Object.ObjectType.ToLower())
{
case "cms.user":
UserInfo ui = (UserInfo)e.Object;
if (ui != null)
{
// do some work here
}
break;
}
}
}
}