views:

33

answers:

3

I'm wondering how to declare permissions and access for more than one defined node type in a module. I'm guessing that as hook_node_info() returns the array like it does then more than one node type can be declared as part of the array but I'm stumped with regards to hook_perm() and hook_perm(). How do I separate the permissions in these hooks for each node type?

A: 

I'd suggest creating submodules, i.e. your mymodule folder would have mymodule.module, which would depend on mymodule_type1.module and mymodule_type2.module (which could be in the same folder, or separated out into separate module folders if you prefer).

ceejayoz
A: 

You might want to look into Features - a system of bundling modules, node types, permissions and other things all together into a single installable unit.

Bevan
+1  A: 

Take a look at my explanation in this answer to a similar question. The gist is that you do not need to declare your own node permissions, as the node module will create the 'standard' node permission set for every node you introduce automatically.

If you need additional permissions, just return them from hook_perm all at once.

Henrik Opel

related questions