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)  

rsModAccessControl.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See modAccessControl.h for a description of this API call.*/
5 
6 #include "modAccessControl.h"
7 #include "specColl.hpp"
8 #include "rsModAccessControl.hpp"
10 #include "miscServerFunct.hpp"
12 
13 int
14 rsModAccessControl( rsComm_t *rsComm, modAccessControlInp_t *modAccessControlInp ) {
16  int status;
17  specCollCache_t *specCollCache = NULL;
18  char newPath[MAX_NAME_LEN];
19  modAccessControlInp_t newModAccessControlInp = *modAccessControlInp;
20 
21  rstrcpy( newPath, newModAccessControlInp.path, MAX_NAME_LEN );
22  resolveLinkedPath( rsComm, newPath, &specCollCache, NULL );
23  if ( strcmp( newPath, newModAccessControlInp.path ) != 0 ) {
24  newModAccessControlInp.path = newPath;
25  }
26 
28  rsComm,
30  ( const char* )newModAccessControlInp.path,
31  &rodsServerHost );
32  if ( status < 0 ) {
33  return status;
34  }
35 
37  std::string svc_role;
38  irods::error ret = get_catalog_service_role(svc_role);
39  if(!ret.ok()) {
40  irods::log(PASS(ret));
41  return ret.code();
42  }
43 
44  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
45  status = _rsModAccessControl( rsComm, &newModAccessControlInp );
46  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
48  } else {
49  rodsLog(
50  LOG_ERROR,
51  "role not supported [%s]",
52  svc_role.c_str() );
54  }
55  }
56  else {
58  &newModAccessControlInp );
59  }
60 
61  if ( status < 0 ) {
63  "rsModAccessControl: rcModAccessControl failed" );
64  }
65  return status;
66 }
67 
68 int
70  modAccessControlInp_t *modAccessControlInp ) {
71  int status, status2;
72 
73  const char *args[MAX_NUM_OF_ARGS_IN_ACTION];
74  ruleExecInfo_t rei2;
75  memset( ( char* )&rei2, 0, sizeof( ruleExecInfo_t ) );
76  rei2.rsComm = rsComm;
77  if ( rsComm != NULL ) {
78  rei2.uoic = &rsComm->clientUser;
79  rei2.uoip = &rsComm->proxyUser;
80  }
81 
82  char rFlag[15];
83  snprintf( rFlag, sizeof( rFlag ), "%d", modAccessControlInp->recursiveFlag );
84  args[0] = rFlag;
85  args[1] = modAccessControlInp->accessLevel;
86  args[2] = modAccessControlInp->userName;
87  args[3] = modAccessControlInp->zone;
88  args[4] = modAccessControlInp->path;
89  int argc = 5;
90  status2 = applyRuleArg( "acPreProcForModifyAccessControl", args, argc, &rei2, NO_SAVE_REI );
91  if ( status2 < 0 ) {
92  if ( rei2.status < 0 ) {
93  status2 = rei2.status;
94  }
96  "rsModAVUMetadata:acPreProcForModifyAccessControl error for %s.%s of level %s for %s,stat=%d",
97  modAccessControlInp->zone,
98  modAccessControlInp->userName,
99  modAccessControlInp->accessLevel,
100  modAccessControlInp->path, status2 );
101  return status2;
102  }
103 
104  status = chlModAccessControl( rsComm,
105  modAccessControlInp->recursiveFlag,
106  modAccessControlInp->accessLevel,
107  modAccessControlInp->userName,
108  modAccessControlInp->zone,
109  modAccessControlInp->path );
110 
111  if ( status == 0 ) {
112  status2 = applyRuleArg( "acPostProcForModifyAccessControl",
113  args, argc, &rei2, NO_SAVE_REI );
114  if ( status2 < 0 ) {
115  if ( rei2.status < 0 ) {
116  status2 = rei2.status;
117  }
119  "rsModAVUMetadata:acPostProcForModifyAccessControl error for %s.%s of level %s for %s,stat=%d",
120  modAccessControlInp->zone,
121  modAccessControlInp->userName,
122  modAccessControlInp->accessLevel,
123  modAccessControlInp->path,
124  status2 );
125  return status;
126  }
127  }
128 
129  return status;
130 }
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
specColl.hpp
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
modAccessControlInp_t::userName
char * userName
Definition: modAccessControl.h:12
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
NO_SAVE_REI
#define NO_SAVE_REI
Definition: rodsDef.h:103
modAccessControl.h
modAccessControlInp_t::accessLevel
char * accessLevel
Definition: modAccessControl.h:11
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
modAccessControlInp_t
Definition: modAccessControl.h:9
rsModAccessControl
int rsModAccessControl(rsComm_t *rsComm, modAccessControlInp_t *modAccessControlInp)
Definition: rsModAccessControl.cpp:14
resolveLinkedPath
int resolveLinkedPath(rsComm_t *rsComm, char *objPath, specCollCache_t **specCollCache, keyValPair_t *condInput)
Definition: specColl.cpp:711
irods::error::code
long long code() const
Definition: irods_error.cpp:194
rsComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:152
modAccessControlInp_t::path
char * path
Definition: modAccessControl.h:14
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
applyRuleArg
int applyRuleArg(const char *action, const char *args[20], int argc, ruleExecInfo_t *rei, int reiSaveFlag)
Definition: irods_re_structs.cpp:95
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
MAX_NUM_OF_ARGS_IN_ACTION
#define MAX_NUM_OF_ARGS_IN_ACTION
Definition: irods_re_structs.hpp:13
SYS_NO_RCAT_SERVER_ERR
@ SYS_NO_RCAT_SERVER_ERR
Definition: rodsErrorTable.h:110
rcModAccessControl
int rcModAccessControl(rcComm_t *conn, modAccessControlInp_t *modAccessControlInp)
Definition: rcModAccessControl.cpp:39
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
getAndConnRcatHost
int getAndConnRcatHost(rsComm_t *rsComm, int rcatType, const char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:26
chlModAccessControl
int chlModAccessControl(rsComm_t *rsComm, int recursiveFlag, const char *accessLevel, const char *userName, const char *zone, const char *pathName)
Definition: icatHighLevelRoutines.cpp:2900
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
RuleExecInfo
Definition: irods_re_structs.hpp:18
modAccessControlInp_t::recursiveFlag
int recursiveFlag
Definition: modAccessControl.h:10
modAccessControlInp_t::zone
char * zone
Definition: modAccessControl.h:13
_rsModAccessControl
int _rsModAccessControl(rsComm_t *rsComm, modAccessControlInp_t *modAccessControlInp)
Definition: rsModAccessControl.cpp:69
icatHighLevelRoutines.hpp
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
rsModAccessControl.hpp
SpecCollCache
Definition: objInfo.h:102