Currently, tac_lite supports only view permissions. A frequent request has been to add update and delete permissions.

Until now, I have not pursued these requests because I could not envision an administrative interface that would make it easy to manage and frankly, I've never really be convinced there was a need for this (because combining tac_lite with drupal permissions can handle a lot of cases). At long last I've done some work in this direction.

The patch I've attached here needs some review and a lot of testing. This issue will track progress.

Note that if you install the patch, run update.php immediately afterwards.

Comments

Dave Cohen’s picture

StatusFileSize
new15.81 KB

Minor fixes...

tjharman’s picture

Happy to give this a test run! You should make a version 2 dev module, you'd get a lot more eyeballs then.

tjharman’s picture

So I have installed this patch and it seems, from my very limited testing, to work OK for the read access side of things. I now have two schemes. My first Scheme gives view permissions to one role, my second Scheme gives view permissions to another role. That seems to work well.

However, I can't figure out the update or delete permissions.

If I give "update" permissions to a role, nothing seems to happen. Should they be able to edit stories/content? Do they need any other special permissions flagged in the Access Control settings?
Currently they have nothing special. Giving them delete access doesn't seem to have any effect either, the nodes still appear to be ready only.

Edit: I have checked with the Devel Node Access block and the articles are getting the right permissions assigned. I think I just need to understand better.

Edit2: Ok, so I am totally stupid. I won't even explain my stupidity. This is working correctly - This post can basically be ignored

I apologise for what probably are dumb questions, but I can't find anywhere on the Druapl site where it's documented how these two new roles should work and if they need to work in conjunction with other permissions. Can anyone give me some pointers here?

I do like the new admin interface though, it was quite intuitive to work with.

Tim

Dave Cohen’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Tim for testing, and troubleshooting yourself.

I'm not sure what you mean by "these two new roles". For documentation, the node access stuff is notoriously tricky, and the documentation I know of is here: http://api.drupal.org/api/group/node_access/5

tjharman’s picture

Yea, as I said, you can ignore that whole post pretty much.

I was not setting the permissions correctly, thus why update wasn't working.

I now have two Schemes, one for Read Access and one for Edit Access. I haven't tested Delete access sorry.

They seem to be working well and "playing together" properly.

aniskhan’s picture

Nice! :) :) :)

I'll test it in a minute. One question though, you mention update and delete permissions. Does update mean create too, or would that be another separate permission?

aniskhan’s picture

StatusFileSize
new84.25 KB

hmm, how can i create a new Scheme under Access Control for tac_lite? Also, see the attached screen shot on how formated the selected vocabulary when under Scheme 1. I think each list should be under its corresponding role heading...

aniskhan’s picture

Ok, you can ignore my previous post, I didn't install the diff patch correctly, now things seem to be working ok :)

So, in testing, it seems like the update permission is not the same as "create" permission. A user can tag a node with a taxonomy that he doesn't have update permission, but then later can't update it...

Dave, I am wondering what made you decide to omit a create permission (since that would be extremelly useful). FYI, my knowledge of Drupal's backend is very limited, I've been getting the hang of things for a couple of months now.

Dave Cohen’s picture

A user can tag a node with a taxonomy that he doesn't have update permission, but then later can't update it...

A user can tag a node with any term he has permission to view. But can only update terms he has permission to update. There is a certain logic in that, but there is also some logic what you suggest. I can imagine writing a hook_form_alter in tac_lite that limits a user's choice of terms to only those she can update.

Any other opinions on how that should work? I'm afraid that doing it either way would be unexpected and/or confusing for some.

I am wondering what made you decide to omit a create permission

Modules like tac_lite cannot control create permission. The node_access table does not allow this, because every entry corresponds to an existing node. In Drupal, create permission is controlled by hook_access, which is defined in the module that defines the node type. Usually, this means you assign create permissions to roles in the usual way. But if you define your own node types you can make the logic more complex.

aniskhan’s picture

Hi Dave, thanks for the thorough reply.

What makes more sense to me is to be able to separate view and create, let me explain why.

I imagine that in most organizations, there are users that have permissions to add certain info to certain sections on their website, while everyone has access to see it. Like the manager of a team should be able the only person allowed to create (and also update/delete) a post in the team's taxonomy. However, everyone should have access to see what has been posted. I can think of dozens of examples like this, where a single user needs create/update/delete permission for a tag, while everyone in the company should be able to access the content of said tag.

I understand what you said about create permissions and how Drupal works in the back-end, and the fact that tac_lite wants to leave minimal footprint upon installation, which it already does nicely since it doesn't create tables in the database...

What you suggest sounds pretty good, a hook_form_alter that simply limits what is shown in the dropdown list of tags to what the user has rights to "create". This wouldn't be hard coded into Drupal since if someone tried to alter the form and post it, it would go through without issues.... What do you think? It would pose as a security issue? I think this solution would work for 99% of the Drupal users out there.

aniskhan’s picture

Oh, and regarding your other question. Obviously, the nice thing would be to have update and create separate, but integrating the hook_form_alter under the update permission is good too... I don't see a scenario where the author of a node shouldn't be allowed to edit it. Of course, the first solution gives more options to the administrator for complex permission schemes, which is always nice.

aniskhan’s picture

And a suggestion on how the interface in the admin/user/access/tac_lite could be, if you decide to implement the hook_form_alter method.

Under "Schemes", there can be a "Update -> Create?" title, and a checkbox that says "Mimic update permissions as create permissions. If checked, when the user wants to create a node, he/she will only see taxonomy words that he/she has permission to update. Note that this feature will simply modify the outputed form to the user, and not set any actual "create" permissions as the Drupal system sees it. As such, an advanced user could post a modified form and go past this."

Or something like that...

Dave Cohen’s picture

Anis, this duplicates the content of a recent email I sent to you...

I don't consider the hook_form_alter a high priority because you could add that sort of logic to your own custom module right now. Nothing's stopping you from doing that.

Also I worry about a clean and intuitive UI. I don't want users to see a node type under "create content" if they can't actually create the content. There's been a lot of talk about adding access control to hook_nodeapi(). That would make it possible to do this cleanly. I'd rather something like that get pushed into core rather than do something kludgy in tac_lite.

That said, I'll consider any patches that get posted. If someone can do this cleanly, great!

Dave Cohen’s picture

Just thinking...

If there is a hook_form_alter, it has to take into account a node created by user X which has been tagged with terms which user Y cannot view or update. Then user Y updates that node, it has to remain tagged with the terms set by user X. Right?

This sort of thing makes me shy away from trying to support it. It feels like it's inviting complicated use cases.

aniskhan’s picture

I don't understand your example. Following what you said:

User X tags a story with "dogs" and "animals"
User Y can't view or update "dogs" nor "animals"

Then you say "Then user Y updates that node..."

How can User Y update that node if they can't update "dogs" nor "animals" ?

Dave Cohen’s picture

Let's say user X can update dogs, cats and bears.

User Y can update cats, but not dogs or bears.

User X creates a node tagged dogs, cats and bears.

User Y updates that node. Now, it's only tagged cats.

You could put some logic in tac_lite to avoid this, but it adds a level of complexity. Also, there's no way tac_lite can know if user Y's edits really did remove the references to the dogs and bears. So its unclear to me what tac_lite should do in such a situation.

This is actually a problem already. Right now, if user Y can update cats, but not VIEW dogs or bears, the same things could happen.

aniskhan’s picture

Why would the node be tagged only cats once Y updates it? This is normal Drupal behavior?
The node looses the other two tags?

Dave Cohen’s picture

When you save a node, the taxonomy module will tag it with only the terms selected on the form. If user Y is editing, and the term "dog" does not appear on the form, it will not be selected and therefore not tagged "dog" after the save. Its basically a weird situation where users X and Y can both edit a node, but they are allowed to see different terms in the form.

I'm not sure how you plan to use this feature, if it existed. But you might be able to think of a better way to design your site.

aniskhan’s picture

I imagine that by using the Taxonomy Access Control module (http://drupal.org/project/taxonomy_access), using your example above, you'd run into the same problem?

Jkello’s picture

How about the cascading of permissions?

If my vocabulary is as shown below,

Vocab > Term > Term
Animals > dogs > german shepboard

In the case where I have permission to view, edit, delete animals tags, will the permission cascade down to german shepard tags?

I can see this module being used together with taxanomy_default which will allow the fixing of permission for a particular content type. This will then make it similar (functionally) to content access... Which is a more efficient way to do things?

Dave Cohen’s picture

In the case where I have permission to view, edit, delete animals tags, will the permission cascade down to german shepard tags?

I think you meant dogs where you wrote animals.
The answer is no. If you have permission to edit nodes tagged dogs, you will not get permission to edit a node tagged german shepherd. If the node were tagged both dogs and german shepherd, you would be able to edit. This is the way drupal's taxonomy works. For instance if you view all nodes tagged dogs, you will not see your node tagged german shepherd. tac_lite is consistant with other taxonomy-based modules in this way. I think what you really want is a module which detects that a node has been tagged german shepherd and automatically adds the dogs tag.

I don't know taxonomy_default so I can't answer the second question.

Jkello’s picture

Oh ok. I understand it now. Thanks.

Are you ready to relaese tac_lite with the 2 new permission of update + edit?

Meanwhile, I will go take a look at the individual user permission UI to see if I have any suggestions.

Dave Cohen’s picture

Status: Reviewed & tested by the community » Fixed

checked it in.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

martin_q’s picture

Status: Closed (fixed) » Active

Do you propose to find a fix for the problem you name in #16?

In response to your request for opinions in #9, my personal opinion is that having the create permission functionally equivalent to the update permission (even if you do this with a hook_form_alter rather than hook_access) is signficantly more intuitive than having it influenced by the view permission. If that doesn't make TAC lite much less lite, I'd be in favour of doing that.

In the meantime, I will have a go at the hook_form_alter within my own custom node types...

Dave Cohen’s picture

Status: Active » Fixed

Please submit a new issue rather than opening a closed one.

Regarding #16, I do not have a fix in mind but I'm open to suggestions. Submit a seperate issue.

Regarding the other issue, the functionality is consistant. When you create a node or update a node, you'll see the same list of terms. The question is whether that list should be the list of terms you can view, or the list you can update. Personally, I think making that the list you can view makes sense, and that's how it works today.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.