[open-ils-commits] r10456 -
trunk/Open-ILS/xul/staff_client/server/admin
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Aug 26 16:03:56 EDT 2008
Author: erickson
Date: 2008-08-26 16:03:52 -0400 (Tue, 26 Aug 2008)
New Revision: 10456
Modified:
trunk/Open-ILS/xul/staff_client/server/admin/adminlib.js
Log:
added method to find "where" a given action can be performed based on perm orgs and a context org
Modified: trunk/Open-ILS/xul/staff_client/server/admin/adminlib.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/adminlib.js 2008-08-26 19:43:21 UTC (rev 10455)
+++ trunk/Open-ILS/xul/staff_client/server/admin/adminlib.js 2008-08-26 20:03:52 UTC (rev 10456)
@@ -75,7 +75,30 @@
}
}
+/*
+ takes org IDs
+ Finds the lowest relevent org unit between a context org unit and a set of
+ permission orgs. This defines the sphere of influence for a given action
+ on a specific set of data. if the context org shares no common nodes with
+ the set of permission orgs, null is returned.
+ returns the orgUnit object
+ */
+function findReleventRootOrg(permOrgList, contextOrgId) {
+ var contextOrgNode = findOrgUnit(contextOrgId);
+ for(var i = 0; i < permOrgList.length; i++) {
+ var permOrg = findOrgUnit(permOrgList[i]);
+ if(orgIsMine(permOrg, contextOrgNode)) {
+ // perm org is equal to or a parent of the context org, so the context org is the highest
+ return contextOrgNode;
+ } else if(orgIsMine(contextOrgNode, permOrg)) {
+ // perm org is a child if the context org, so permOrg is the highest org
+ return permOrg;
+ }
+ }
+ return null;
+}
+
/* offset is the depth of the highest org
in the tree we're building
*/
More information about the open-ils-commits
mailing list