[development] deny user #1

Gerhard Killesreiter gerhard at killesreiter.de
Wed Sep 13 12:24:14 UTC 2006


Augustin (Beginner) wrote:
> Hello,
> 
> I have a module where I define a new node type (created with the usual hooks, 
> hook_node_info(), etc.). 
> The nodes of this type are created and updated when importing data from a 
> remote server.
> 
> In drupal, $user->uid == 1 has all the rights.
> I would like to prevent this user #1 from creating / updating such nodes.
> All users may view the nodes.
> 
> What is the best way to accomplish this?
> 
> Returning FALSE on hook_access() when $op != "view" doesn't work for user #1.

A brute force method is to unset the form and redirect elsewhere in 
hook_form_alter if you are processing your node form and uid == 1.


Cheers,
	Gerhard


More information about the development mailing list