[development] problems with permissions on node

nitin gupta nitingupta.iitg at gmail.com
Wed Nov 18 14:24:44 UTC 2009


use node_access, http://api.drupal.org/api/function/node_access/6
--
Regards,
Nitin Kumar Gupta
http://publicmind.in/blog/


On Wed, Nov 18, 2009 at 6:58 PM, Lluís <enboig at gmail.com> wrote:

> I have created a custom permission node; I should be able to edit that
> node, but I am unable. How should my nodetype_access function be to
> allow read/write/delete access?
>
> function nodetype_access($op, $node, $account) {
>  $is_author = $account->uid == $node->uid;
>  switch ($op) {
>    case 'create':
>      return user_access('create nodetype', $account);
>    case 'update':
>      $output = user_access('edit own nodetype', $account) && is_author ||
>        user_access('edit any nodetype', $account);
>      if ($output) return TRUE;
>    case 'delete':
>      return user_access('delete own nodetype', $account) && $is_author ||
>        user_access('delete any nodetype', $account);
>  }
> }
>
>
> --
> *Les normes hi són perquè hi pensis abans de saltar-te-les
> *La vida és com una taronja, què esperes a exprimir-la?
> *Si creus que l'educació és cara, prova la ignorància.
> *La vida és com una moneda, la pots gastar en el que vulguis però
> només una vegada.
> *Abans d'imprimir aquest missatge, pensa en el medi ambient.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091118/0ed7b681/attachment.html 


More information about the development mailing list