views:

10

answers:

3

I am happy with the standard Page and Story content types.

Still I need more control over the access control.

I would like to write my own access control.

I like the concept of the hook_access() for controlling access to the content types you build your self.

Do I have a hook_access() available when I am using my content type?

+1  A: 

The content access module allows you to set access control on a per content type, or even per node basis.

Simon
Thanks for your reply, but actually, I want to check the result of a php function to decide whether the current user has access to the content or not. The result of this function is based on the user and the content. Is there any solution?
Ahmad Khajenezhad
In that case using hook_access is the way to do this - http://api.drupal.org/api/function/hook_access/6
Simon
A: 

I would like to write my own access control.

Simon is right, the content_access module is probably what you're looking for. Don't reinvent the wheel if you don't have to.

I like the concept of the hook_access() for controlling access to the content types you build your self.

This is the preferred "drupal way"

Do I have a hook_access() available when I am using my content type?

hook_access is available to all content types since all content types are stored in the form of a node. hook_access is called whenever any one the defined (nodeapi) operations are called.

Andrew Sledge
A: 

"hook_access is available to all content types since all content types are stored in the form of a node." this is exactly what I want, but it seems that hook_access works just for content types that are created by a module, not for content types which are created in the standard form (using GUI). I know that I don't speak English so good, do you get what I said?

Ahmad Khajenezhad