1

I have a weird problem and was hoping maybe someone on this community experienced it before or would know a better way to debug the issue.

I help manage a large group of multi-sites in Drupal 7.52. There are currently 9 websites and thousands of nodes, so its not a tiny system. we have 13 roles (including the basic - 6 are custom).

Two of these roles are checked to see "View Interactive Information Bar". Description of this permission is "Allow users to view the IIB. This may allow users to perform administrative tasks.".

There are a bunch more but I will use the above as the example to the issue. We will go say 2-3 weeks with no issues and then all of a sudden this permission will become un-checked ONLY for our custom roles. This applies to a bunch of other permissions as well, what is odd is its not ALL the permissions. It is only a few and they keep repeating, the above permission is one.

I will go in and check it back on, it will be fine for a day and then boom, unchecked again. I will repeat this for maybe 2-3 days and then it will be fine for weeks.

I've checked the logs, error logs etc... and nothing is coming up. I've tried checking CRON to see if it happens when CRON runs but nothing. It almost seems random.

Has anyone ever come across this before? Or know of a way to possibly debug this?

Thanks!

  • The only thing I could think of is maybe someone is doing a Features revert, if you have Features module... maybe a server cron job or deploy task that triggers drush fr.. or something of that nature. Or someone has some errant code in a hook_init if they were debugging and forgot.. Or could someone be possibly executing a SQL script that overwrites the perm tables? – Kevin Mar 1 '17 at 15:44
  • I will scan for hook_init on some of the custom modules we have, perhaps somebody did. Thanks! – Aaron C Mar 1 '17 at 21:01
0

To debug, add a user update hook and check if they role is being unchecked, then log the $edit to your watchdog log then you should be able to see who/what is causing this change. This is a very rough example and you'd have to customize it to fit your roles etc.

function YOURMODULE_user_update(&$edit, $account, $category) {
   if (user_has_role($YOUR_ROLE_RID, $account) {
     debug($account, 'account', true);
     debug($edit, 'edit request', true);
     // maybe add an email notification letting you know the event fired
   }
}

You can then test it by manually disabling that role and see if the debug messages appear in your log. Then if it works, just wait and see what happens when the mysterious permissions troll strikes again.

| improve this answer | |
  • Will give it a try and let you know! – Aaron C Mar 1 '17 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.