I'm just curious before I start to tie this into what we're doing... Is there a way to make a call (API like) that would say "give this user role xyz and expire in 6 months"? I see that you can do it via the UI and clicking through to user accounts and adding roles for a duration of time (which works really well). I'm just checking that should I do a DB insert into role_expire_admin (for example) that cron will look at it and drop the admin role for whatever user uid i've inserted in there in 6 months?

Thanks

Comments

bdziewierz’s picture

There are four API functions that you can use to control expiry dates:

role_expire_add_role($uid, $rid, $expiry_timestamp = NULL);
role_expire_remove_role($uid, $rid);

role_expire_set_expiry_date($uid, $rid, $expiry_timestamp);
role_expire_clear_expiry_date($uid, $rid);

Arguments should be self explanatory. If you need better documentation on that, please let me know, I will try to put together some kind of API doc.

btopro’s picture

awesome, that's what I was hoping for. Most of them seem to make sense, only question I have is if you clear the expiry date for a role does that keep the role for that user but remove the date it's revoked, treating it as any "normal" user role in the system?

bdziewierz’s picture

That's correct. role_expire_clear_expiry_date only clears expiry date keeping the role association intact (User becomces member of the role for indefinate time).

bdziewierz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.