Give the user a "Change Permissions" link for a content type?

I'm trying to find a simple solution to a specific problem that allows bloggers on my site to control the permissions for individual posts. This way, they can decide whether to show their messages to all visitors or only to authenticated users.

The closest module solution I've found so far is the Node Access Module . It comes very close, but for me it is not quite the case, in the sense that it creates a new "grant" tab for the content type and then displays checkboxes with too many permission options (allow the role to view, edit and delete). where I only want to display the view parameter and I need it to be right on the edit / create content page, not in a separate tab.

If I don't find an alternative simple solution, I will have to add a hacked blog module or something else. I cannot think of any other way to do this.

Any ideas?

+2


source to share


2 answers


If you want to avoid coding and keep things simple, there are several solutions that come to mind.



  • TAC Lite allows you to associate a dictionary with an access control scheme. Each term can be associated with different view / edit permissions for specific users or user roles.

    In this case, you need one term in the configured dictionary. Set it so that this term ("Restricted Access") is set to restrict access to only authenticated users.

    The benefit of TAC_lite is the flexibility to build your access model as new requirements emerge, such as having "premium subscribers" accessing even more limited content.

  • Content Access allows you to set access control rules by content type and override node. I cannot speak to the UI as I have not used this mode.

+4


source


If the proposal Graysides (good) does not fit, you can do it yourself, do not "hack" a blog module, making hook_nodeapi()

and hook_form_alter()

in the user module:

  • In boot mode "hooks" you can add a check for the current access parameters to nodes, related to anonymous and authenticated users. You would add a property to this node object (be aware of possible name collisions), you must prefix the custom property names of the node object with the name of your module).
  • Through, hook_form_alter()

    you'll add a form element (like radio buttons) to the edit node form for your blog nodes, which will allow users to choose visibility using the new node property by default.
  • In insert

    and update

    operations, hook_nodeapi()

    you must check the new property again and adjust the node access settings accordingly.


Note that this approach may interfere with other actions of the node accessor, so some clarification may be needed. I don't recommend this - I just wanted to suggest an alternative to "hack the kernel".

0


source







All Articles