+/* see if the card used to login is marked as barred */
+static oilsEvent* oilsAuthCheckCard( osrfMethodContext* ctx, jsonObject* userObj, char* barcode) {
+ if(!(ctx && userObj && barcode)) return NULL;
+ osrfLogDebug(OSRF_LOG_MARK, "Checking to see if barcode %s is active", barcode);
+
+ jsonObject* params = jsonParseString("{\"barcode\":\"%s\"}", barcode);
+ jsonObject* card = oilsUtilsQuickReq(
+ "open-ils.cstore", "open-ils.cstore.direct.actor.card.search", params );
+
+ char* active = oilsFMGetString(card, "active");
+ if( ! oilsUtilsIsDBTrue(active) ) {
+ osrfLogInfo(OSRF_LOG_MARK, "barcode %s is not active, returning event", barcode);
+ return oilsNewEvent(OSRF_LOG_MARK, "PATRON_CARD_INACTIVE");
+ }
+ return NULL;
+}
+
+
+
int oilsAuthComplete( osrfMethodContext* ctx ) {
OSRF_METHOD_VERIFY_CONTEXT(ctx);
return 0;
}
+ osrfLogDebug(OSRF_LOG_MARK, "BARCODE = %s", barcode);
+ if( barcode && (response = oilsAuthCheckCard( ctx, userObj, barcode )) ) {
+ osrfAppRespondComplete( ctx, oilsEventToJSON(response) );
+ oilsEventFree(response);
+ free(barcode);
+ return 0;
+ }
+
int passOK = -1;
if(uname) passOK = oilsAuthVerifyPassword( ctx, userObj, uname, password );
}
+int oilsUtilsIsDBTrue( char* val ) {
+ if( val && strcasecmp(val, "f") && strcmp(val, "0") ) return 1;
+ return 0;
+}
+
+
long oilsFMGetObjectId( jsonObject* obj ) {
long id = -1;
if(!obj) return id;
return oilsUtilsQuickReq( "open-ils.storage", method, params );
}
+jsonObject* oilsUtilsCStoreReq( char* method, jsonObject* params ) {
+ return oilsUtilsQuickReq("open-ils.cstore", method, params);
+}
+
jsonObject* oilsUtilsFetchUserByUsername( char* name ) {
jsonObject* oilsUtilsStorageReq( char* method, jsonObject* params );
+jsonObject* oilsUtilsCStoreReq( char* method, jsonObject* params );
+
/**
* Searches the storage server for a user with the given username
* Caller is responsible for freeing the returned object
jsonObject* oilsUtilsFetchUserByBarcode(char* barcode);
jsonObject* oilsUtilsFetchWorkstationByName( char* name );
+
+
+int oilsUtilsIsDBTrue( char* val );