hudmol/archivesspace — pull request #243 by marktriggs (2013-01-28 02:42:35+00:00)
Title: Fine grained permissions rebase

Assigning this to Payten because it'd be good if he looks over what I've done to the frontend, but anyone should feel free to have a look :)

There's a lot of stuff here, but the big changes:

* I've added a new .permissions() declaration to each endpoint, preferred to using the lower-level .preconditions(). It just takes a list of permissions that are required to use the endpoint. I think this is better because we can generate useful documentation from it for each endpoint.

* I've added an annoying .nopermissionsyet declaration to some endpoints. This prints an annoying message to remind us to figure out how permissions of these endpoints should operate. Currently there are none.

* I've split the very coarse :update_repository permission into several more fine-grained permissions. These are oriented around the different access types described in the staff user specs, where access to subjects, agents and locations is managed separately to the other record types. I've referred to the other record types as "archival records", which I know isn't great, but I can't think of a better term right now.

* I've added an endpoint that just returns the current user and modified the frontend to use that.

* I've cleaned up the ACL filters on the frontend to avoid having to create one filter for each permission we want to check. Turns out before_filter can take a block. Hurrah.

* I've defined the new 'project manager' role within a repository and set its permissions as described in the user story.

* I've gone through the UI templates and converted the permissions to the more fine-grained ones where it makes sense.

Comments that I'll add to Pivotal once this is merged:

I'm marking this as delivered because I think what I've got makes
sense in the context of the current system. One requirement I
couldn't address was this one:

Read-only access to user records (other than their own)

I wasn't sure what to do here because, in the current implementation,
users are global but project managers are repository-scoped. It
didn't seem to make sense to give a project manager read access to all
users just because they were a PM in a single repository.

As things stand I don't think there's any functionality in the
frontend that requires one user to be able to see the details of
another. Maybe as future stories define some of this functionality it
will become more obvious how to approach this?