[open-ils-commits] [GIT] Evergreen ILS branch master updated. 95d400fa439135d3d42b26b9fe3c14d2ec767788

Evergreen Git git at git.evergreen-ils.org
Tue Oct 16 20:56:21 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  95d400fa439135d3d42b26b9fe3c14d2ec767788 (commit)
       via  a419c63b407de4ff5999858cac6af07e1512eed1 (commit)
       via  fe03e6f93e7f47157dc0e549ff2ff382a05dfe28 (commit)
      from  e50d4cef406bee50dbb5ea780a0f06807736e38f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 95d400fa439135d3d42b26b9fe3c14d2ec767788
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Tue Oct 16 20:55:38 2012 -0400

    Upgrade script numbering for new toolbar perms
    
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 504ee6c..9a70b3a 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0740', :eg_version); -- miker/senator
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0741', :eg_version); -- phasefx/senator
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.toolbar_perms.sql b/Open-ILS/src/sql/Pg/upgrade/0741.data.toolbar_perms.sql
similarity index 91%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.toolbar_perms.sql
rename to Open-ILS/src/sql/Pg/upgrade/0741.data.toolbar_perms.sql
index 36b9a7b..b214f36 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.toolbar_perms.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0741.data.toolbar_perms.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0741', :eg_version);
 
 INSERT INTO permission.perm_list ( id, code, description ) VALUES (
     540,

commit a419c63b407de4ff5999858cac6af07e1512eed1
Author: Kathy Lussier <klussier at masslnc.org>
Date:   Wed Oct 10 22:18:59 2012 -0400

    Brief entry for release notes on more granular permissions for custom toolbars
    
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/docs/RELEASE_NOTES_NEXT/toolbar_perms.txt b/docs/RELEASE_NOTES_NEXT/toolbar_perms.txt
new file mode 100644
index 0000000..111ab52
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/toolbar_perms.txt
@@ -0,0 +1,12 @@
+Upgrade Notes
+-------------
+Custom toolbar permissions
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+With the addition of more granular permissions for configuring a custom
+toolbars, the ADMIN_TOOLBAR permission alone will not allow users to 
+configure a custom toolbar. This permission must now be used in conjunction
+with one or more of the following permissions:
+
+* ADMIN_TOOLBAR_FOR_ORG
+* ADMIN_TOOLBAR_FOR_USER
+* ADMIN_TOOLBAR_FOR_WORKSTATION

commit fe03e6f93e7f47157dc0e549ff2ff382a05dfe28
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Thu Sep 20 11:27:43 2012 -0400

    lp1053026, more granular toolbar editing perms
    
    client-side checking only to keep the honest folk out
    
    Adds ADMIN_TOOLBAR_FOR_ORG, ADMIN_TOOLBAR_FOR_USER, and
    ADMIN_TOOLBAR_FOR_WORKSTATION to the permission list
    
    Staff needs at least one of these to create a toolbar, and they still need the
    original ADMIN_TOOLBAR permission which is used on the server side of things.
    
    For editing an existing toolbar, staff needs the perm corresponding to the
    toolbar's ownership type (for example, if the toolbar is associated with a
    user, then ADMIN_TOOLBAR_FOR_USER is needed).
    
    For changing the ownership type of a toolbar one is allowed to edit, you
    need the corresponding perm for the desired ownership type.
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 7a6eb16..5668078 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -1567,7 +1567,13 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
  ( 538, 'VIEW_SEARCH_FILTER_GROUP', oils_i18n_gettext( 538,
     'Allows staff to view search filter groups and entries', 'ppl', 'description' )),
  ( 539, 'UPDATE_ORG_UNIT_SETTING.ui.hide_copy_editor_fields', oils_i18n_gettext( 539,
-    'Allows staff to edit displayed copy editor fields', 'ppl', 'description' ))
+    'Allows staff to edit displayed copy editor fields', 'ppl', 'description' )),
+ ( 540, 'ADMIN_TOOLBAR_FOR_ORG', oils_i18n_gettext( 540,
+        'Allows a user to create, edit, and delete custom toolbars for org units', 'ppl', 'description')),
+ ( 541, 'ADMIN_TOOLBAR_FOR_WORKSTATION', oils_i18n_gettext( 541,
+        'Allows a user to create, edit, and delete custom toolbars for workstations', 'ppl', 'description')),
+ ( 542, 'ADMIN_TOOLBAR_FOR_USER', oils_i18n_gettext( 542,
+        'Allows a user to create, edit, and delete custom toolbars for users', 'ppl', 'description'))
 ;
 
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.toolbar_perms.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.toolbar_perms.sql
new file mode 100644
index 0000000..36b9a7b
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.toolbar_perms.sql
@@ -0,0 +1,35 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO permission.perm_list ( id, code, description ) VALUES (
+    540,
+    'ADMIN_TOOLBAR_FOR_ORG',
+    oils_i18n_gettext(
+        540,
+        'Allows a user to create, edit, and delete custom toolbars for org units',
+        'ppl',
+        'description'
+    )
+), (
+    541,
+    'ADMIN_TOOLBAR_FOR_WORKSTATION',
+    oils_i18n_gettext(
+        541,
+        'Allows a user to create, edit, and delete custom toolbars for workstations',
+        'ppl',
+        'description'
+    )
+), (
+    542,
+    'ADMIN_TOOLBAR_FOR_USER',
+    oils_i18n_gettext(
+        542,
+        'Allows a user to create, edit, and delete custom toolbars for users',
+        'ppl',
+        'description'
+    )
+);
+
+COMMIT;
+
diff --git a/Open-ILS/xul/staff_client/server/admin/toolbar.js b/Open-ILS/xul/staff_client/server/admin/toolbar.js
index d0dc3cc..8e04b8a 100644
--- a/Open-ILS/xul/staff_client/server/admin/toolbar.js
+++ b/Open-ILS/xul/staff_client/server/admin/toolbar.js
@@ -56,8 +56,41 @@ function my_init() {
         $('context_usr').setAttribute('label', fieldmapper.IDL.fmclasses.atb.field_map.usr.label);
         $('context_ws').setAttribute('label', fieldmapper.IDL.fmclasses.atb.field_map.ws.label);
 
+
+        var perms_not_had = perm_check();
+        if (perms_not_had.length == 3) { // has none of those perms
+            $('New').disabled = true;
+        }
+
+    } catch(E) {
+        try { g.error.standard_unexpected_error_alert('admin/toolbar.xul',E); } catch(F) { alert(E); }
+    }
+}
+
+function perm_check(use_this_org, use_these_perms) {
+    try {
+        // poor man's perm check - just a screen door to keep the honest folk out
+
+        var context_org = use_this_org || ses('ws_ou');
+        var perms_to_check = use_these_perms || [ 'ADMIN_TOOLBAR_FOR_ORG', 'ADMIN_TOOLBAR_FOR_WORKSTATION', 'ADMIN_TOOLBAR_FOR_USER' ];
+
+        JSAN.use('util.network');
+        var net = new util.network();
+        var robj = net.simple_request(
+            'PERM_CHECK',[
+                ses(),
+                ses('staff_id'),
+                context_org,
+                perms_to_check
+            ]
+        );
+        if (typeof robj.ilsevent != 'undefined') {
+            throw(robj);
+        }
+        return robj;
     } catch(E) {
         try { g.error.standard_unexpected_error_alert('admin/toolbar.xul',E); } catch(F) { alert(E); }
+        return perms_to_check; // assume failure so return the perms
     }
 }
 
@@ -140,6 +173,53 @@ function handle_list1_selection(ev) {
         g.layout = JSON2js(g.selected_atb.layout());
         populate_list2_list3();
         xulG.render_toolbar_layout(g.layout);
+
+        // permission checks
+
+        var perms_not_had = perm_check( g.selected_atb.org() );
+        var disable_editing = false;
+        for (var i = 0; i < perms_not_had.length; i++) {
+            if (perms_not_had[i] == 'ADMIN_TOOLBAR_FOR_ORG' && g.selected_atb.org()) {
+                disable_editing = true;
+            }
+            if (perms_not_had[i] == 'ADMIN_TOOLBAR_FOR_WORKSTATION' && g.selected_atb.ws()) {
+                disable_editing = true;
+            }
+            if (perms_not_had[i] == 'ADMIN_TOOLBAR_FOR_USER' && g.selected_atb.usr()) {
+                disable_editing = true;
+            }
+        }
+        if (g.selected_atb.usr() && ( g.selected_atb.usr() != ses('staff_id') ) ) {
+            disable_editing = true; // if a user toolbar, only allow editing of your own toolbars (just in case)
+        }
+
+        if (disable_editing) {
+            ['Add','Remove','Up','Down','Delete','Save','context_org','context_ws','context_usr'].forEach(
+                function(e,i,a) {
+                    $(e).disabled = true;
+                }
+            );
+        } else {
+            ['Add','Remove','Up','Down','Delete','Save','context_org','context_ws','context_usr'].forEach(
+                function(e,i,a) {
+                    $(e).disabled = false;
+                }
+            );
+        }
+
+        // don't allow changing ownership axis without perm
+        for (var i = 0; i < perms_not_had.length; i++) {
+            if (perms_not_had[i] == 'ADMIN_TOOLBAR_FOR_ORG') {
+                $('context_org').disabled = true;
+            }
+            if (perms_not_had[i] == 'ADMIN_TOOLBAR_FOR_WORKSTATION') {
+                $('context_ws').disabled = true;
+            }
+            if (perms_not_had[i] == 'ADMIN_TOOLBAR_FOR_USER') {
+                $('context_usr').disabled = true;
+            }
+        }
+
     } catch(E) {
         alert('Error in toolbar.js, handle_list1_selection(): ' + E);
     }
@@ -500,6 +580,11 @@ function Delete(ev) {
 
 function New(ev) {
     try {
+        var perms_not_had = perm_check();
+        if (perms_not_had.length == 3) {
+            return; // we do disable the New button, but Operator Change can get around that
+        }
+
         var name = window.prompt('Enter label for toolbar:');
         if (!name) { return; }
 
@@ -507,7 +592,13 @@ function New(ev) {
         new_atb.isnew('1');
         new_atb.label(name);
         new_atb.layout('[]');
-        new_atb.usr(ses('staff_id'));
+        if (perms_not_had.indexOf('ADMIN_TOOLBAR_FOR_USER') == -1) {
+            new_atb.usr(ses('staff_id'));
+        } else if (perms_not_had.indexOf('ADMIN_TOOLBAR_FOR_WORKSTATION') == -1) {
+            new_atb.ws(ses('ws_id'));
+        } else if (perms_not_had.indexOf('ADMIN_TOOLBAR_FOR_ORG') == -1) {
+            new_atb.org($('lib_menu').value);
+        }
 
         var rdata = g.list1.append({
             'row' : {

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |    8 ++-
 .../src/sql/Pg/upgrade/0741.data.toolbar_perms.sql |   35 ++++++++
 Open-ILS/xul/staff_client/server/admin/toolbar.js  |   93 +++++++++++++++++++-
 docs/RELEASE_NOTES_NEXT/toolbar_perms.txt          |   12 +++
 5 files changed, 147 insertions(+), 3 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0741.data.toolbar_perms.sql
 create mode 100644 docs/RELEASE_NOTES_NEXT/toolbar_perms.txt


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list