1 #include "opensrf/osrf_json.h"
2 #include "opensrf/log.h"
7 // XXX replacing this with liboils_idl implementation
8 // #include "openils/fieldmapper_lookup.h"
10 #include "openils/idl_fieldmapper.h"
12 #include "oils_event.h"
13 #include "oils_constants.h"
14 #include "opensrf/osrf_app_session.h"
15 #include "opensrf/osrf_settings.h"
22 Loads the IDL. Returns NULL on failure
23 or a pointer to the IDL data structure on success.
24 @param idl_filename If not provided, we'll fetch the
25 filename from the settings server
27 osrfHash* oilsInitIDL( const char* idl_filename );
29 const char* oilsFMGetStringConst( const jsonObject* object, const char* field );
31 char* oilsFMGetString( const jsonObject* object, const char* field );
33 const jsonObject* oilsFMGetObject( const jsonObject* object, const char* field );
36 Sets the given field in the given object to the given string
37 @param object The object to update
38 @param field The field to change
39 @param string The new data
40 @return 0 if the field was updated successfully, -1 on error
42 int oilsFMSetString( jsonObject* object, const char* field, const char* string );
45 * Returns the data stored in the id field of the object if it exists
46 * returns -1 if the id field or the id value is not found
48 long oilsFMGetObjectId( const jsonObject* obj );
52 * Checks if the user has each permission at the given org unit
53 * Passing in a -1 for the orgid means to use the top level org unit
54 * The first permission that fails causes the corresponding permission
55 * failure event to be returned
56 * returns NULL if all permissions succeed
58 oilsEvent* oilsUtilsCheckPerms( int userid, int orgid, char* permissions[], int size );
62 * Performs a single request and returns the resulting data
63 * Caller is responsible for freeing the returned response object
65 jsonObject* oilsUtilsQuickReq( const char* service, const char* method,
66 const jsonObject* params );
68 jsonObject* oilsUtilsStorageReq( const char* method, const jsonObject* params );
70 jsonObject* oilsUtilsCStoreReq( const char* method, const jsonObject* params );
73 * Searches the storage server for a user with the given username
74 * Caller is responsible for freeing the returned object
76 jsonObject* oilsUtilsFetchUserByUsername( const char* name );
80 * Returns the setting value
81 * Caller must free the returned string
83 char* oilsUtilsFetchOrgSetting( int orgid, const char* setting );
87 * Logs into the auth server with the given username and password
88 * @return The authtoken string which must be de-allocated by the caller
90 char* oilsUtilsLogin( const char* uname, const char* passwd, const char* type, int orgId );
94 * Fetches the requested workstation object by id
96 jsonObject* oilsUtilsFetchWorkstation( long id );
98 jsonObject* oilsUtilsFetchUserByBarcode(const char* barcode);
100 jsonObject* oilsUtilsFetchWorkstationByName( const char* name );
103 int oilsUtilsIsDBTrue( const char* val );