[OPEN-ILS-DEV] (Patch) Make group permission setup a bit easier to decipher

Warren Layton warren.layton at gmail.com
Wed Nov 11 22:00:03 EST 2009


I don't know what you think of this patch. I wrote it up after
noticing the following comment in the
Open-ILS/src/sql/Pg/950.data.seed-values.sql file:

   -- XXX Incomplete base permission setup.  A patch would be appreciated.

Now, I have no idea what the base permission setup should look like
for the average library. However, figuring out what permissions are
currently being applied is difficult with lines such as:

   INSERT INTO permission.grp_perm_map VALUES (57, 2, 15, 0, false);

...when it could be rewritten as:

   -- Add basic patron permissions to the Patrons group
   INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
VALUES (2, (SELECT id FROM permission.perm_list WHERE code =
'RENEW_CIRC'), 0, false);

To me, this patch makes it very clear which permissions are assigned
to which groups (the permissions for the Acquisition groups are
currently set in this way, too). This added clarity may help when
someone more knowledgeable than me tries to figure out what the "base
permission setup" should be for each group.

The only possible problems are:
1) The id in permission.grp_perm_map is not explicitly set with these
changes (e.g., in the first INSERT statement, above, the id is
explicitly set to 57). This didn't seem like a problem to me, but I
could be wrong.
2) I noticed that just before the Acquisitions group permissions, the
following line is present:
    SELECT SETVAL('permission.grp_perm_map_id_seq'::TEXT, (SELECT
MAX(id) FROM permission.grp_perm_map));
I'm not sure if I should have included it at the the start of the
block that I changed (given that I'm not explicitly setting the id
value).

Let me know what you think and feel free to kick it back to me if
changes are needed.

Thanks!
  Warren Layton
  NRCan Library / Bibliothèque RNCan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grp_perm_patch.diff
Type: text/x-diff
Size: 32102 bytes
Desc: not available
Url : http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20091111/2079ef7c/attachment-0001.diff 


More information about the Open-ils-dev mailing list