[drupal-devel] [task] Make posting permission more granular.

Cvbge drupal-devel at drupal.org
Tue Apr 26 21:07:17 UTC 2005


Issue status update for http://drupal.org/node/10426

 Project:      Drupal
 Version:      cvs
 Component:    comment.module
 Category:     tasks
 Priority:     normal
 Assigned to:  killes at www.drop.org
 Reported by:  killes at www.drop.org
 Updated by:   Cvbge
 Status:       patch

Hello


I need to be able to
a) post/reply etc on forums as anonymous user
b) do not anon users to edit it's own (probably made by other anon
users) forum posts
c) do not allow anyone to post comments to any other node types


AFAIK currently it's not possibile, but it'd be possibile with this
patch, so I'd be glad it it was accepted.




Cvbge



Previous comments:
------------------------------------------------------------------------

August 29, 2004 - 05:55 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/node-access-comment.patch (5 KB)

There have been requests to private forums. I think the most
straightforward way to allow them is by extending the node_access hook.


The attached patch tries this. It assumes that my node object caching
patch got committed. Afterwards loading a node twice won't be a
performance issue anymore.


The patch is untested, I'd like to get feedback on the implementation.




------------------------------------------------------------------------

August 31, 2004 - 15:53 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/node-access-comment_0.patch (5.02 KB)

The patch is now tested.


I think this needs a better explanations: The patch isn't only for
forums (which still need some kind of taxonomy permissions) but applies
to all nodes. You can set individual nodes to be commentable through the
_access hook. This would be helpfull for a forum where only a selected
role should be allowed to post, but others should read the
announcements.




------------------------------------------------------------------------

September 4, 2004 - 07:57 : killes at www.drop.org

The patch has a small problem: 


We need either to move this check



<?php
if ($op == 'comment' && $node->comment == 2 && user_access('post
comments')) {
    return TRUE;
}
?>




before the db query (and thus taking away a bit of the power from that
patch) or add a grant_comment column to the node_access table:


alter table node_access add grant_comment tinyint(1) unsigned NOT NULL
default '0';




------------------------------------------------------------------------

September 5, 2004 - 09:42 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/node-access-comment_0_0.patch (4.78 KB)

Keeping up with CVS. I'd like to receive some feedback on the resolution
of the problme mentioned above.




------------------------------------------------------------------------

September 13, 2004 - 01:25 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/module_0.patch (7.1 KB)

Keeping up with cvs. Node modules should implement _access('comment').




------------------------------------------------------------------------

September 14, 2004 - 05:38 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/commentable.patch (7.89 KB)

Had forgotten blog.module




------------------------------------------------------------------------

February 4, 2005 - 23:19 : Steven

Is this patch still needed? Doesn't it tie comment.module unnecessarily
into node.module?




------------------------------------------------------------------------

February 7, 2005 - 23:01 : killes at www.drop.org

Yes, the patch is still needed.


The patch actually removes more code from node.module than it adds.
Both modules are essential to Drupal and some degree of interaction is
tolerable, I think. You can still disable comment.module withou any ill
effects.







More information about the drupal-devel mailing list