This wiki space is archived.

The active wiki for the Samvera Community can be found here: https://samvera.atlassian.net/


Child pages
  • Code for Permission Templates


This wiki space is archived. The active wiki for the Samvera Community can be found here: https://samvera.atlassian.net/

Skip to end of metadata
Go to start of metadata

Table of Contents


Where is the code for permission templates?


What information do they hold?

I'm guessing it is this kind of information...

  • participants for an admin set
  • visibility template for a work created in an admin set
  • selected workflow to use for works created in an admin set

You can get a good sense of what PTs hold by looking at the PTForm; https://github.com/samvera/hyrax/blob/master/app/forms/hyrax/forms/permission_template_form.rb

Permissions templates have a 1-1 relationship to admin sets.  Admin sets are the Fedora portion of the implementation, and Permission templates are the database portion. 

  • Permission templates hold the visibility information for the admin set (visibility, release date, and release period). There is a lot of behind-the-scenes logic using these in determining the embargo logic (see pull request https://github.com/samvera/hyrax/pull/490) which would be much clearer if the information were explicitly stored in the permission template.
  • Via the child table "Permission template accesses", they also store each of the participants (either user or group) which has been granted access via the permission template (the agent id, agent type, and access for the permission template)
  • Sipity::Workflows are stamped with the active permission template id. 

When are they created?

I'm guessing that it is when the admin set is created.  And possibly when a work is created to hold participant information?

Yes, permission templates are created by the AdminSetCreateService: https://github.com/samvera/hyrax/blob/master/app/services/hyrax/admin_set_create_service.rb#L62

They can also be created by the DefaultAdminSetActor: https://github.com/samvera/hyrax/blob/master/app/actors/hyrax/actors/default_admin_set_actor.rb#L44

When are they used?

I'm guessing when a work is created, the participants are assigned access, the visibility of the work is set based on the visibility template, and the workflow is attached to the work.

I believe that is correct.

Potential Pitfalls



  • No labels