Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access control via (and on) taxonomy terms #823

Closed
mjordan opened this issue Apr 30, 2018 · 16 comments
Closed

Access control via (and on) taxonomy terms #823

mjordan opened this issue Apr 30, 2018 · 16 comments
Assignees
Milestone

Comments

@mjordan
Copy link
Contributor

mjordan commented Apr 30, 2018

Given the importance of taxonomies in CLAW, we need to be able to control access to content that has particular terms applied to it and also to the ability to assign the terms themselves. Looks like https://www.drupal.org/project/permissions_by_term is the best contrib module to allow those things. I will test and report back here.

@mjordan mjordan self-assigned this Apr 30, 2018
@ajs6f
Copy link

ajs6f commented Apr 30, 2018

This sounds super-useful! Might there be some overlap with other authZ needs? E.g. if I define a collection via a property value ("All resources with :hasColor :blue") this could be used to associate authZ with it, as opposed to using containment...

@mjordan
Copy link
Contributor Author

mjordan commented Apr 30, 2018

Not sure, but assuming we can sync taxonomy terms with properties, I could imagine a Context that checks for the taxonomy term equivalent of :hasColor : blue and the containing pcdm:memberOf and allows access to the Drupal resource accordingly. But writing that out now makes me think that we'll need a SPARQL query in there somewhere.

@ajs6f
Copy link

ajs6f commented Apr 30, 2018

Sorry, I was imagining that :blue is a term, and PCDM isn't in play. Maybe some better examples would be:

  1. :hasAuthor orcid:0000-0002-1825-0097
  2. rdf:type aat:300181918

that kind of thing. And since we at SI have no intention of using PCDM for anything (I don't think any site that isn't a library would want to do that) I'm imagining a collection (in the generic sense, not the library sense, maybe better to use the word "class") that just is all things with (say) :hasAuthor orcid:0000-0002-1825-0097. To do that in RDF might indeed require a SPARQL query, but to do that from the Drupal side wouldn't, would it?

@whikloj
Copy link
Member

whikloj commented Apr 30, 2018

@ajs6f As long as you are not looking for any owl:sameAs type checks but just a straight give me all the objects that have X value for Y field, then yes we could do this straight in Drupal.

As of the recent change to modelling in Drupal I think only @dannylamb can say for sure whether this is already on the radar.

@mjordan
Copy link
Contributor Author

mjordan commented Apr 30, 2018

OK, thanks. Taxonomy terms can have URIs as internal (to Drupal) IDs, so if I am understanding your example, you could add all your researcher's ORCHiDs as a taxonomy and apply them to nodes (and then, via Views, get an instant listing of all of a researcher's works). But to Drupal they are still just standard taxonomy terms, which can in fact be used to control access and pretty much anything else you can implement using either existing contributed modules (in fact the one that I mention in the initial issue above does just that) or via Context.

@dannylamb has had a lot more experience in the CLAW context (ha, no pun intended) with using taxonomies, as evidenced during his demo last week. He may want to weigh in on this, but I think that the answer to your initial question above is 'yes'.

In fact, we currently use taxonomies in a Fedoraless-Drupal 6 site (our institutional repository) to define what are the equivalent of "collections" in Islandora 7.x, and to define who may add members to them and who may view their members. Each collection is a single taxonomy term, with child collections being child terms.

@mjordan
Copy link
Contributor Author

mjordan commented Apr 30, 2018

Damit ninjad by @whikloj

@ajs6f
Copy link

ajs6f commented May 1, 2018

@mjordan @whikloj This sounds better and better! No, I wasn't thinking about inference or anything like that-- just plain ol' properties right on the resource.

@mjordan
Copy link
Contributor Author

mjordan commented May 1, 2018

I don't think https://www.drupal.org/project/permissions_by_term is going to be suitable. Permissions are set at the term level, not the taxonomy level, in the term CRUD form. Help text: "To limit access to this term by user(s) or role(s), select users or roles above. If left empty, all users will have access to content, related to this taxonomy term and this taxonomy term itself."

My tests confirm that if a term is restricted to a role (didn't test specific users, but that's also an option), then only users of that role can assign the term to content, and only users of that role can access that content. This means that we can't use this module to restrict who can assign terms without restricting who can access content with those terms. Will move on to other taxonomy ACL modules.

@mjordan
Copy link
Contributor Author

mjordan commented May 1, 2018

But.... since taxonomies are linked to entities as fields, we can use https://www.drupal.org/project/field_permissions to control what roles can assign terms from specific taxonomies at the taxonomy level. Granularity of permissions this module provides are:

claw823

So, as is often the case in Drupal, a combination of contrib modules solves the problem(s). The problems here being:

  1. we will want to restrict some taxonomies that effect repository-wide behaviors like what gets pushed into Fedora or how different types of content get rendered to end users. https://www.drupal.org/project/field_permissions should be useful here.
  2. we will want to be able to control access to specific nodes, or all nodes that have a specific taxo term applied to them (@ajs6f 's collections). https://www.drupal.org/project/permissions_by_term will help us here.

@mjordan
Copy link
Contributor Author

mjordan commented May 2, 2018

As per the CLAW call on May 2, I have created structured use cases.

@dmoses
Copy link
Contributor

dmoses commented Aug 2, 2018

Have other approaches besides taxonomies been considered for access control?

The ACL module coupled with the Content Access module seems to be a potential approach. Both have ports (alpha at the moment) to Drupal 8.

@mjordan
Copy link
Contributor Author

mjordan commented Aug 3, 2018

@dmoses here's a list of issues relating to access control (there might be others):

Given the discussion over at #888, we might want to review these issues/use cases and document the various ways the Drupal 8 will let us control who sees and manages what. Not sure of the best mechanism for this review is at the moment however.

@mjordan
Copy link
Contributor Author

mjordan commented Sep 5, 2018

Relevant blog post listing a variety of ways to control access to Drupal 8 content: https://www.optasy.com/blog/how-do-you-restrict-access-content-drupal-8-6-modules-will-do-job-you.

@mjordan
Copy link
Contributor Author

mjordan commented Jan 24, 2019

We need to test controlling access to media/files using tags, for example terms from the Media Use vocabulary.

@mjordan
Copy link
Contributor Author

mjordan commented Feb 1, 2019

I installed and enabled the Permissions by Term module and its submodule Permissions by Entity (which is needed to provide access control by term to Media) and they appear to work as expected. By configuring specific taxonomy terms, I was able to restrict access to authenticated users to the node, media (using direct URL to media) and the media's file (using direct URL to file). Not tested, but this should work with any role and even individual users.

@dannylamb
Copy link
Contributor

This is tested and working with permissions_by_term

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants