[open-ils-commits] [GIT] Evergreen ILS branch rel_2_2 updated. 125697b0d5cb7efc9ee1440a0fa93dacaa41e27f

Evergreen Git git at git.evergreen-ils.org
Thu Nov 8 13:22:24 EST 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, rel_2_2 has been updated
       via  125697b0d5cb7efc9ee1440a0fa93dacaa41e27f (commit)
      from  8dfb887686cb7a81a09b46c9d917c150bdd14d7a (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 125697b0d5cb7efc9ee1440a0fa93dacaa41e27f
Author: Mike Rylander <mrylander at gmail.com>
Date:   Wed Oct 10 17:36:52 2012 -0400

    Make it possible to suppress IDL fields
    
    Some clients of external services, particularly pcrud and reporter-store,
    need to be able to access tables that contain columns we'd rather restrict.
    For instance, the passwd field on actor.usr.
    
    To effect this feature we provide a blacklist attribute for fields, called
    suppress_controller, which works in the same way as the class controller
    attribute but names controllers not allowed to use the field.  When the field
    is explicitly named in a query (fieldmapper select block or json_query) an
    error is thrown, and suppressed fields are ingored in general fieldmapper
    search/retreive requests.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index d388b86..af64c25 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -2686,7 +2686,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Is Group Lead Account" name="master_account" reporter:datatype="bool"/>
 			<field reporter:label="Internet Access Level" name="net_access_level" reporter:datatype="link"/>
 			<field reporter:label="Other Phone" name="other_phone"  reporter:datatype="text"/>
-			<field reporter:label="Password" name="passwd"  reporter:datatype="text"/>
+			<field reporter:label="Password" name="passwd" suppress_controller="open-ils.pcrud open-ils.reporter-store" reporter:datatype="text"/>
 			<field reporter:label="Photo URL" name="photo_url"  reporter:datatype="text"/>
 			<field reporter:label="Prefix/Title" name="prefix"  reporter:datatype="text"/>
 			<field reporter:label="Main (Profile) Permission Group" name="profile" reporter:datatype="link"/>
diff --git a/Open-ILS/examples/fm_IDL.xsd b/Open-ILS/examples/fm_IDL.xsd
index b2720a1..7ebbd51 100644
--- a/Open-ILS/examples/fm_IDL.xsd
+++ b/Open-ILS/examples/fm_IDL.xsd
@@ -51,6 +51,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
    <xs:element ref="idl:description" minOccurs="0" maxOccurs="1"/>
   </xs:sequence>
   <xs:attribute name="name"/>
+  <xs:attribute name="suppress_controller"/>
   <xs:attribute ref="oils_obj:array_position"/>
   <xs:attribute ref="oils_obj:required"/>
   <xs:attribute ref="oils_obj:validate"/>
diff --git a/Open-ILS/src/c-apps/oils_idl-core.c b/Open-ILS/src/c-apps/oils_idl-core.c
index 471435c..5d432ab 100644
--- a/Open-ILS/src/c-apps/oils_idl-core.c
+++ b/Open-ILS/src/c-apps/oils_idl-core.c
@@ -156,6 +156,13 @@ osrfHash* oilsIDLInit( const char* idl_filename ) {
 						snprintf( array_pos_buf, sizeof( array_pos_buf ), "%u", array_pos++ );
 						osrfHashSet( field_def_hash, strdup( array_pos_buf ), "array_position" );
 
+						// Tokenize suppress_controller attribute into an osrfStringArray
+						if( (prop_str = (char*)xmlGetProp(_f, BAD_CAST "suppress_controller")) ) {
+							osrfLogDebug(OSRF_LOG_MARK, "Controller suppression list is %s", prop_str );
+							osrfStringArray* controller = osrfStringArrayTokenize( prop_str, ' ' );
+							osrfHashSet( field_def_hash, controller, "suppress_controller");
+						}
+
 						if( (prop_str = (char*)xmlGetNsProp(_f, BAD_CAST "i18n", BAD_CAST PERSIST_NS)) ) {
 							osrfHashSet(
 								field_def_hash,
diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c
index b262a70..a0ba678 100644
--- a/Open-ILS/src/c-apps/oils_sql.c
+++ b/Open-ILS/src/c-apps/oils_sql.c
@@ -4203,7 +4203,16 @@ char* SELECT (
 
 					// Look up the field in the IDL
 					const char* col_name = jsonObjectGetString( selfield );
-					osrfHash* field_def = osrfHashGet( class_field_set, col_name );
+					osrfHash* field_def;
+
+					if (!osrfStringArrayContains(
+							osrfHashGet(
+								osrfHashGet( class_field_set, col_name ),
+								"suppress_controller"),
+							modulename
+					))
+						field_def = osrfHashGet( class_field_set, col_name );
+
 					if( !field_def ) {
 						// No such field in current class
 						osrfLogError(
@@ -4282,7 +4291,16 @@ char* SELECT (
 							jsonObjectGetKeyConst( selfield, "column" ) );
 
 					// Get the field definition from the IDL
-					osrfHash* field_def = osrfHashGet( class_field_set, col_name );
+					osrfHash* field_def;
+					if (!osrfStringArrayContains(
+							osrfHashGet(
+								osrfHashGet( class_field_set, col_name ),
+								"suppress_controller"),
+							modulename
+					))
+						field_def = osrfHashGet( class_field_set, col_name );
+
+
 					if( !field_def ) {
 						// No such field in current class
 						osrfLogError(
@@ -5202,6 +5220,9 @@ static char* buildSELECT ( const jsonObject* search_hash, jsonObject* rest_of_qu
 			if( !field )
 				continue;
 
+			if (osrfStringArrayContains( osrfHashGet(field, "suppress_controller"), modulename ))
+				continue;
+
 			if( first ) {
 				first = 0;
 			} else {
@@ -6056,6 +6077,10 @@ int doUpdate( osrfMethodContext* ctx ) {
 		if( str_is_true( osrfHashGet( field_def, "virtual") ) )
 			continue;
 
+		if (osrfStringArrayContains( osrfHashGet(field_def, "suppress_controller"), modulename ))
+			continue;
+
+
 		const char* field_name = osrfHashIteratorKey( field_itr );
 		if( ! strcmp( field_name, pkey ) )
 			continue;
diff --git a/Open-ILS/web/reports/xul/source-browse.js b/Open-ILS/web/reports/xul/source-browse.js
index 4075dd1..0442e3a 100644
--- a/Open-ILS/web/reports/xul/source-browse.js
+++ b/Open-ILS/web/reports/xul/source-browse.js
@@ -36,6 +36,9 @@ function sourceTreeHandler (ev, dbl) {
 				var name = field.getAttributeNS(rptNS,'label');
 				if (!name) name = field.getAttribute('name');
 
+				var suppress = field.getAttribute('suppress_controller');
+				if (suppress && suppress.indexOf('open-ils.reporter-store') > -1) continue;
+
 				var idlclass = link_fields[i].getAttribute('class');
 				var map = link_fields[i].getAttribute('map');
 				var link = link_fields[i].getAttribute('field');
diff --git a/Open-ILS/web/reports/xul/source-setup.js b/Open-ILS/web/reports/xul/source-setup.js
index 7a9ca84..ebb6a6d 100644
--- a/Open-ILS/web/reports/xul/source-setup.js
+++ b/Open-ILS/web/reports/xul/source-setup.js
@@ -300,6 +300,9 @@ function populateDetailTree (tcNode, c, item) {
 		var type = fields[i].getAttributeNS(rptNS, 'datatype');
 		//if (!type) type = 'text';
 
+		var suppress = fields[i].getAttribute('suppress_controller');
+		if (suppress && suppress.indexOf('open-ils.reporter-store') > -1) continue;
+
 		var label = fields[i].getAttributeNS(rptNS, 'label');
 		var name = fields[i].getAttribute('name');
 		if (!label) label = name;

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

Summary of changes:
 Open-ILS/examples/fm_IDL.xml              |    2 +-
 Open-ILS/examples/fm_IDL.xsd              |    1 +
 Open-ILS/src/c-apps/oils_idl-core.c       |    7 +++++++
 Open-ILS/src/c-apps/oils_sql.c            |   29 +++++++++++++++++++++++++++--
 Open-ILS/web/reports/xul/source-browse.js |    3 +++
 Open-ILS/web/reports/xul/source-setup.js  |    3 +++
 6 files changed, 42 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list