2

I am creating a rule that will help to manage permissions, but I only want it to run for the user with uid=1.

Is there a way to add a Rules Condition based on user data? Is such a condition prone to problems, and should I instead need to create a new permission?

3
  • There's only one root user, and it always has ID: 1...
    – Clive
    Apr 23, 2014 at 15:20
  • I can reference the uid as a field? I did not think of that.
    – Hoytman
    Apr 23, 2014 at 15:25
  • Yes exactly, you can just do a simple data comparison against user:uid
    – Clive
    Apr 23, 2014 at 15:27

1 Answer 1

1

Sure there is such Rules Condition. As an example, have a look at the Rule I included in my answer to "How to stop a Views block from displaying to admins, such as user/1?".

The Rules Condition included that answer performs a Data Comparison to check if the value of site:current-user:uid is not equal to 1 (in your case you'd want to check if it is equal to 1).

Note: This specific Rules Condition comes in handy for anything you want to enforce (or prohibit?) for super user user/1 (which typically skips all permissions), similar to what the question was about in the linked question here.

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.