irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rsTicketAdmin.cpp
Go to the documentation of this file.
1 
4 /* See ticketAdmin.h for a description of this API call.*/
5 
6 #include "ticketAdmin.h"
7 #include "rsTicketAdmin.hpp"
9 #include "miscServerFunct.hpp"
11 
12 int
13 rsTicketAdmin( rsComm_t *rsComm, ticketAdminInp_t *ticketAdminInp ) {
15  int status;
16 
17  rodsLog( LOG_DEBUG, "ticketAdmin" );
18 
19  status = getAndConnRcatHost( rsComm, MASTER_RCAT, ( const char* )NULL, &rodsServerHost );
20  if ( status < 0 ) {
21  return status;
22  }
23 
25  std::string svc_role;
26  irods::error ret = get_catalog_service_role(svc_role);
27  if(!ret.ok()) {
28  irods::log(PASS(ret));
29  return ret.code();
30  }
31 
32  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
33  status = _rsTicketAdmin( rsComm, ticketAdminInp );
34  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
36  } else {
37  rodsLog(
38  LOG_ERROR,
39  "role not supported [%s]",
40  svc_role.c_str() );
42  }
43  }
44  else {
45  if ( strcmp( ticketAdminInp->arg1, "session" ) == 0 ) {
46  ticketAdminInp->arg3 = rsComm->clientAddr;
47  }
49  ticketAdminInp );
50  }
51 
52  if ( status < 0 ) {
54  "rsTicketAdmin failed, error %d", status );
55  }
56  return status;
57 }
58 
59 int
60 _rsTicketAdmin( rsComm_t *rsComm, ticketAdminInp_t *ticketAdminInp ) {
61  int status;
62  if ( strcmp( ticketAdminInp->arg1, "session" ) == 0 ) {
63  ruleExecInfo_t rei;
64 
65  memset( ( char* )&rei, 0, sizeof( rei ) );
66  rei.rsComm = rsComm;
67  rei.uoic = &rsComm->clientUser;
68  rei.uoip = &rsComm->proxyUser;
69  status = applyRule( "acTicketPolicy", NULL, &rei, NO_SAVE_REI );
70  rodsLog( LOG_DEBUG, "debug ticket rule status:%d", status );
71  if ( status != 0 ) {
72  return status;
73  }
74  }
75  status = chlModTicket( rsComm, ticketAdminInp->arg1,
76  ticketAdminInp->arg2, ticketAdminInp->arg3,
77  ticketAdminInp->arg4, ticketAdminInp->arg5 );
78  return status;
79 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::CFG_SERVICE_ROLE_CONSUMER
const std::string CFG_SERVICE_ROLE_CONSUMER("consumer")
irods_configuration_keywords.hpp
rodsServerHost::localFlag
int localFlag
Definition: rodsConnect.h:68
SYS_SERVICE_ROLE_NOT_SUPPORTED
@ SYS_SERVICE_ROLE_NOT_SUPPORTED
Definition: rodsErrorTable.h:217
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
rcTicketAdmin
int rcTicketAdmin(rcComm_t *conn, ticketAdminInp_t *ticketAdminInp)
Definition: rcTicketAdmin.cpp:9
NO_SAVE_REI
#define NO_SAVE_REI
Definition: rodsDef.h:103
rsTicketAdmin.hpp
rsTicketAdmin
int rsTicketAdmin(rsComm_t *rsComm, ticketAdminInp_t *ticketAdminInp)
Definition: rsTicketAdmin.cpp:13
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
chlModTicket
int chlModTicket(rsComm_t *rsComm, const char *opName, const char *ticket, const char *arg1, const char *arg2, const char *arg3)
Definition: icatHighLevelRoutines.cpp:4403
ticketAdminInp_t::arg1
char * arg1
Definition: ticketAdmin.h:7
irods::error::code
long long code() const
Definition: irods_error.cpp:194
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
rsComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:152
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
ticketAdminInp_t::arg2
char * arg2
Definition: ticketAdmin.h:8
SYS_NO_RCAT_SERVER_ERR
@ SYS_NO_RCAT_SERVER_ERR
Definition: rodsErrorTable.h:110
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
rsComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:153
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
ticketAdminInp_t::arg3
char * arg3
Definition: ticketAdmin.h:9
ticketAdminInp_t::arg4
char * arg4
Definition: ticketAdmin.h:10
ticketAdmin.h
getAndConnRcatHost
int getAndConnRcatHost(rsComm_t *rsComm, int rcatType, const char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:26
MASTER_RCAT
#define MASTER_RCAT
Definition: rodsDef.h:85
get_catalog_service_role
irods::error get_catalog_service_role(std::string &_role)
Definition: miscServerFunct.cpp:3153
rodsServerHost
Definition: rodsConnect.h:62
ticketAdminInp_t::arg5
char * arg5
Definition: ticketAdmin.h:11
RuleExecInfo
Definition: irods_re_structs.hpp:18
_rsTicketAdmin
int _rsTicketAdmin(rsComm_t *rsComm, ticketAdminInp_t *ticketAdminInp)
Definition: rsTicketAdmin.cpp:60
ticketAdminInp_t
Definition: ticketAdmin.h:6
applyRule
int applyRule(char *inAction, msParamArray_t *inMsParamArray, ruleExecInfo_t *rei, int reiSaveFlag)
Definition: irods_re_structs.cpp:65
icatHighLevelRoutines.hpp
rsComm_t::clientAddr
char clientAddr[64]
Definition: rcConnect.h:151
irods::error::ok
bool ok()
Definition: irods_error.cpp:258