[OPEN-ILS-GENERAL] Re: Patron Groups

Dan Scott denials at gmail.com
Mon Mar 24 13:46:41 EDT 2008


On 24/03/2008, Edward Corrado <corrado at tcnj.edu> wrote:
> OK, I just noticed if I go to http://localhostcgi-bin/usr_group-setup.cgi I can make new groups, so I figured that part out. I'll also figured out how to break things :-(. I apparently made the existing default patron group (now renamed TCNJ Patron), a child of itself, and now it doesn't show up. Any idea on how to fix this? I tried going to http://localhost/cgi-bin/usr_group-setup.cgi?action=child&id=2 (which should be the group id), but it just times out.

Hi Ed:

First, I should note that a new set of administration interfaces are
in development that will probably be a little more defensive about
these sorts of things. But for now we're back to SQL - you're dealing
with the permission.grp_tree table, which is defined like so:

evergreen=# \d permission.grp_tree
                                  Table "permission.grp_tree"
      Column      |   Type   |                            Modifiers
------------------+----------+------------------------------------------------------------------
 id               | integer  | not null default
nextval('permission.grp_tree_id_seq'::regclass)
 name             | text     | not null
 parent           | integer  |
 usergroup        | boolean  | not null default true
 perm_interval    | interval | not null default '3 years'::interval
 description      | text     |
 application_perm | text     |
Indexes:
    "grp_tree_pkey" PRIMARY KEY, btree (id)
    "grp_tree_name_key" UNIQUE, btree (name)
    "grp_tree_parent_idx" btree (parent)
Foreign-key constraints:
    "grp_tree_parent_fkey" FOREIGN KEY (parent) REFERENCES
permission.grp_tree(id) ON DELETE RESTRICT

So the hierarchy is based on the "parent" column in the table. That's
what we're going to need to fix in your version of the table. The
default settings are:

evergreen=# select id, name, parent from permission.grp_tree;
 id |            name            | parent
----+----------------------------+--------
  1 | Users                      |
  2 | Patrons                    |      1
  3 | Staff                      |      1
  4 | Catalogers                 |      3
  5 | Circulators                |      3
 10 | Local System Administrator |      3

So, find your 'TCNJ Patron' entry and update its parent value to
something reasonable (1, unless you renamed the 'Users' group to 'TCNJ
Patron', in which case you'll want to update it to NULL). For the sake
of argument, let's pretend you changed the 'Patrons' group to have
itself as parent; its ID is 2, so we can issue an update to the table
like so:

evergreen=# update permission.grp_tree set parent = 1 where id = 2;
UPDATE 1

And the results are as we would expect:

evergreen=# select id, name, parent from permission.grp_tree;
 id |            name            | parent
----+----------------------------+--------
  1 | Users                      |
  2 | Patrons                    |      1
  3 | Staff                      |      1
  4 | Catalogers                 |      3
  5 | Circulators                |      3
 10 | Local System Administrator |      3

-- 
Dan Scott
Laurentian University


More information about the Open-ils-general mailing list