[development] RE: [support] node_access table

VJ vrao at misteam.net
Thu Dec 29 23:37:40 UTC 2005


Thanks.

I have node_privacy_byrole installed, but setting everything to 0 for both
node_privacy_byrole_role and node_privacy_byrole_user has no effect..i.e
anyone can access it.

Anyway, Ive had problems with that module before which is why I was
wondering if I can bypass it...i.e set the permissions myself in code. On
my site, when an user clicks 'complete' (which is a custom button), the
node should immediately become read only.

>From your email, I get the impression that I have to use a module. Why is
that? do these modules change the node_load query?

Thanks,

V

> The short answer here is that it depends on which access control modules
> you're using. If you're using the "og module" it's different then if
> you're using "node privacy by role".  If I understand it correctly,
> without additional modules installed this table doesn't do anything.
>
> You should be extremely careful about modifying this table without using
> the API's for the appropriate access module.  More info is in the
> hook_access on the Drupal Api documentation.
>
> If you still want to do th is programatically then here's and example:
>
> If you're using node_privacy_by_role, then an example insert would be:
>
> Insert into node_access
> (nid,gid,realm,grant_view,grant_update,grant_delete)
>    values
> (<node>,<role_id>,'node_access_byrole_role',<grant_view>,<grant_update>,
> <grant_delete>)
>
>
>
> With the followign replacements:
>   <node> The node id that you're protecting - find from node edit screen
>   <role_id> the role ID for the role your granting access to.
>   <grant_view> 1 if the role can view, otherwise 0
>   <grant_update> 1 if the role can update, otherwise 0
>   <grant_delete> 1 if the role can delete, otherwise 0
>
>
> -----Original Message-----
> From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
> Behalf Of VJ
> Sent: Thursday, December 29, 2005 9:20 AM
> To: support at drupal.org
> Cc: development at drupal.org
> Subject: [support] node_access table
>
>
>
> How does this table work? If I want to remove comment and update rights
> to a specific user (or role), whats the exact SQL query?
>
> Thanks,
>
> V
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>





More information about the development mailing list