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"
16 #include "opensrf/osrf_application.h"
23 Loads the IDL. Returns NULL on failure
24 or a pointer to the IDL data structure on success.
25 @param idl_filename If not provided, we'll fetch the
26 filename from the settings server
28 osrfHash* oilsInitIDL( const char* idl_filename );
30 const char* oilsFMGetStringConst( const jsonObject* object, const char* field );
32 char* oilsFMGetString( const jsonObject* object, const char* field );
34 const jsonObject* oilsFMGetObject( const jsonObject* object, const char* field );
37 Sets the given field in the given object to the given string
38 @param object The object to update
39 @param field The field to change
40 @param string The new data
41 @return 0 if the field was updated successfully, -1 on error
43 int oilsFMSetString( jsonObject* object, const char* field, const char* string );
46 * Returns the data stored in the id field of the object if it exists
47 * returns -1 if the id field or the id value is not found
49 long oilsFMGetObjectId( const jsonObject* obj );
53 * Checks if the user has each permission at the given org unit
54 * Passing in a -1 for the orgid means to use the top level org unit
55 * The first permission that fails causes the corresponding permission
56 * failure event to be returned
57 * returns NULL if all permissions succeed
59 oilsEvent* oilsUtilsCheckPerms( int userid, int orgid, char* permissions[], int size );
63 * Performs a single request and returns the resulting data
64 * Caller is responsible for freeing the returned response object
66 jsonObject* oilsUtilsQuickReq( const char* service, const char* method,
67 const jsonObject* params );
69 jsonObject* oilsUtilsQuickReqCtx( osrfMethodContext* ctx, const char* service,
70 const char* method, const jsonObject* params );
72 jsonObject* oilsUtilsStorageReq( const char* method, const jsonObject* params );
73 jsonObject* oilsUtilsStorageReqCtx( osrfMethodContext* ctx, const char* method, const jsonObject* params );
75 jsonObject* oilsUtilsCStoreReq( const char* method, const jsonObject* params );
76 jsonObject* oilsUtilsCStoreReqCtx( osrfMethodContext* ctx, const char* method, const jsonObject* params );
79 * Searches the storage server for a user with the given username
80 * Caller is responsible for freeing the returned object
82 jsonObject* oilsUtilsFetchUserByUsername( osrfMethodContext* ctx, const char* name );
86 * Returns the setting value
87 * Caller must free the returned string
89 char* oilsUtilsFetchOrgSetting( int orgid, const char* setting );
93 * Logs into the auth server with the given username and password
94 * @return The authtoken string which must be de-allocated by the caller
96 char* oilsUtilsLogin( const char* uname, const char* passwd, const char* type, int orgId );
100 * Fetches the requested workstation object by id
102 jsonObject* oilsUtilsFetchWorkstation( long id );
104 jsonObject* oilsUtilsFetchUserByBarcode(osrfMethodContext* ctx, const char* barcode);
106 jsonObject* oilsUtilsFetchWorkstationByName( const char* name );
109 int oilsUtilsIsDBTrue( const char* val );
111 long oilsUtilsIntervalToSeconds( const char* interval );
114 * Creates actor.usr_activity entries
115 * @return The number of rows created. 0 or 1.
117 int oilsUtilsTrackUserActivity( osrfMethodContext* ctx, long usr, const char* ewho, const char* ewhat, const char* ehow );
120 * Returns the ID of the root org unit (parent_ou = NULL)
122 int oilsUtilsGetRootOrgId();