@@ -435,24 +435,26 @@ namespace {
435
435
idx.schedule_collection_operation (
436
436
irods::indexing::operation_type::index ,
437
437
logical_path,
438
- _rei->rsComm ->clientUser .userName
439
- , " ::metadata" // value // -> Empty fields for index_name , index_type ,
440
- , " " // units // and index technology will signal that the collection
441
- ); // operation should search upward in hierarchy for indexing tags
438
+ _rei->rsComm ->clientUser .userName ,
439
+ " ::metadata" , // value // -> Empty fields for index name, type, and technology
440
+ " " // units // technology will signal that the collection operation
441
+ ); // should search upward in the hierarchy for indexing tags.
442
442
}
443
443
else {
444
444
idx.schedule_metadata_indexing_event (
445
- logical_path,
446
- _rei->rsComm ->clientUser .userName ,
447
- " null" // attribute,
448
- " bb" // value,
449
- " cc" // units
445
+ logical_path,
446
+ _rei->rsComm ->clientUser .userName ,
447
+ " null" , // attribute, // -> the actual values are irrelevant now that we're using the
448
+ " bb" , // value, // NIEHS metadata schema
449
+ " cc" // units
450
450
);
451
451
}
452
452
}
453
453
}
454
- catch (const std::exception &e){ const char * message = e.what ();
455
- rodsLog (LOG_NOTICE," Exception during pep_api_data_obj_unlink_post: %s" ,message); }
454
+ catch (const std::exception &e) {
455
+ const char * message = e.what ();
456
+ rodsLog (LOG_NOTICE," Exception during pep_api_data_obj_unlink_post: %s" ,message);
457
+ }
456
458
}
457
459
else if (" pep_api_data_obj_unlink_post" == _rn) {
458
460
auto it = _args.begin ();
@@ -748,25 +750,23 @@ namespace {
748
750
749
751
private:
750
752
751
- std::map<std::string,std::string> users {}
752
- , groups {};
753
- std::map<std::string,std::list<std::string>> members {};
754
- std::map<std::string,int > user_entry {};
755
- std::multimap<int ,std::string> user_perms {}
756
- ,group_perms {};
757
- std::string owner {};
753
+ std::map<std::string,std::string> users_{}, groups_{};
754
+ std::map<std::string,std::list<std::string>> members_{};
755
+ std::map<std::string,int > user_entry_{};
756
+ std::multimap<int ,std::string> user_perms_{}, group_perms_{};
757
+ std::string owner_{};
758
758
759
- int idx {0 };
759
+ int idx_ {0 };
760
760
761
- rsComm_t *Conn {};
761
+ rsComm_t *conn {};
762
762
763
763
static std::map<int ,std::string> perm_names;
764
764
765
765
public:
766
766
767
767
bool is_group ( const std::string &gid ) {
768
768
try {
769
- groups .at (gid);
769
+ groups_ .at (gid);
770
770
}
771
771
catch (const std::out_of_range&) {
772
772
return false ;
@@ -776,7 +776,7 @@ namespace {
776
776
777
777
bool is_member_of (const std::string& user_id, const std::string& group_id) {
778
778
try {
779
- const auto & user_list = members .at (group_id);
779
+ const auto & user_list = members_ .at (group_id);
780
780
return std::find ( user_list.begin (), user_list.end (), user_id) != user_list.end ();
781
781
}
782
782
catch (...) {
@@ -786,44 +786,44 @@ namespace {
786
786
return false ;
787
787
}
788
788
789
- void calc_perm_info ( const std::string & obj_id, const std::string & obj_type);
789
+ void calc_perm_info ( const std::string& obj_id, const std::string& obj_type);
790
790
791
791
void calc_user_info () {
792
- irods::query q {Conn , " select USER_GROUP_NAME,USER_GROUP_ID,USER_NAME,USER_ID" };
792
+ irods::query q{conn , " select USER_GROUP_NAME,USER_GROUP_ID,USER_NAME,USER_ID" };
793
793
for (const auto & c:q) {
794
794
if (c[1 ] != c[3 ]) {
795
- members [c[1 ]].push_back (c[3 ]);
796
- groups [c[1 ]]=c[0 ];
795
+ members_ [c[1 ]].push_back (c[3 ]);
796
+ groups_ [c[1 ]]=c[0 ];
797
797
}
798
798
else {
799
- users [c[3 ]]=c[2 ];
799
+ users_ [c[3 ]]=c[2 ];
800
800
}
801
801
}
802
802
}
803
803
804
804
void reset_perms_ () {
805
- if (idx != 0 ) {
806
- user_entry = {};
807
- group_perms = {};
808
- user_perms = {};
809
- owner = {};
805
+ if (idx_ != 0 ) {
806
+ user_entry_ = {};
807
+ group_perms_ = {};
808
+ user_perms_ = {};
809
+ owner_ = {};
810
810
}
811
- idx = 0 ;
811
+ idx_ = 0 ;
812
812
}
813
813
814
814
public:
815
815
816
- permissions_calculator (rsComm_t *Conn_ )
817
- : Conn{Conn_ }
816
+ permissions_calculator (rsComm_t *_conn )
817
+ : conn{_conn }
818
818
{
819
819
calc_user_info ();
820
820
}
821
821
822
- permissions_calculator (const permissions_calculator & x, rsComm_t *Conn_ )
823
- : users {x.users }
824
- , groups {x.groups }
825
- , members {x.members }
826
- , Conn{Conn_ }
822
+ permissions_calculator (const permissions_calculator & x, rsComm_t *_conn )
823
+ : users_ {x.users_ }
824
+ , groups_ {x.groups_ }
825
+ , members_ {x.members_ }
826
+ , conn{_conn }
827
827
{
828
828
reset_perms_ ();
829
829
}
@@ -832,16 +832,16 @@ namespace {
832
832
{
833
833
calc_perm_info ( obj_id, obj_type);
834
834
835
- for (const auto & [pm,gid] : group_perms ) {
836
- j[" userPermissions" ][idx ][" permission" ] = perm_names.at (pm);
837
- j[" userPermissions" ][idx ++][" user" ] = groups [gid];
835
+ for (const auto & [pm,gid] : group_perms_ ) {
836
+ j[" userPermissions" ][idx_ ][" permission" ] = perm_names.at (pm);
837
+ j[" userPermissions" ][idx_ ++][" user" ] = groups_ [gid];
838
838
}
839
- for (const auto & [pm,uid] : user_perms ) {
840
- j[" userPermissions" ][idx ][" permission" ] = perm_names.at (pm);
841
- j[" userPermissions" ][idx ++][" user" ] = users [uid];
839
+ for (const auto & [pm,uid] : user_perms_ ) {
840
+ j[" userPermissions" ][idx_ ][" permission" ] = perm_names.at (pm);
841
+ j[" userPermissions" ][idx_ ++][" user" ] = users_ [uid];
842
842
}
843
- j[" creator" ] = owner ;
844
- idx = -1 ; // force structures to be reinitialized on reuse
843
+ j[" creator" ] = owner_ ;
844
+ idx_ = -1 ; // force structures to be reinitialized on reuse
845
845
}
846
846
};
847
847
@@ -859,26 +859,26 @@ namespace {
859
859
860
860
/* calculate:
861
861
owner (aka the creator of the object) */
862
- irods::query qown { Conn , boost::str (boost::format (" select %s_OWNER_NAME where %s_ID = '%s'" )
862
+ irods::query qown { conn , boost::str (boost::format (" select %s_OWNER_NAME where %s_ID = '%s'" )
863
863
% obj_type % obj_type % obj_id ) };
864
864
for (const auto & row : qown) {
865
- owner = row[0 ];
865
+ owner_ = row[0 ];
866
866
break ;
867
867
}
868
868
869
869
/* calculate:
870
870
group_perms - maps the reported group permissions to the corresponding group IDs
871
871
user_entry - maps the IDs of users which *not* groups to the permission levels reported for them
872
872
*/
873
- irods::query qprm { Conn , boost::str (boost::format (" select %s_ACCESS_TYPE,%s_ACCESS_USER_ID where %s_ID = '%s'" )
873
+ irods::query qprm { conn , boost::str (boost::format (" select %s_ACCESS_TYPE,%s_ACCESS_USER_ID where %s_ID = '%s'" )
874
874
% obj_type % obj_type % obj_type % obj_id ) };
875
875
for (const auto & i : qprm) {
876
876
const auto iperm=std::stol (i[0 ]);
877
877
if (is_group (i[1 ])) {
878
- group_perms .insert ( make_pair (iperm, i[1 ]));
878
+ group_perms_ .insert (make_pair (iperm, i[1 ]));
879
879
}
880
880
else {
881
- user_entry [i[1 ]] = iperm;
881
+ user_entry_ [i[1 ]] = iperm;
882
882
}
883
883
}
884
884
@@ -888,12 +888,12 @@ namespace {
888
888
This is done by scanning group_perms to ensure each user in question is not a member of a group having equal
889
889
or higher privilege.
890
890
*/
891
- for (const auto & [uid,iperm] : user_entry ) {
891
+ for (const auto & [uid,iperm] : user_entry_ ) {
892
892
bool include_user = true ;
893
- for (auto it = group_perms .lower_bound (iperm); it!= group_perms .end (); it++) {
893
+ for (auto it = group_perms_ .lower_bound (iperm); it!= group_perms_ .end (); it++) {
894
894
if (is_member_of (uid,it->second )) { include_user = false ; break ; }
895
895
}
896
- if (include_user) { user_perms .insert ( make_pair (iperm, uid)); }
896
+ if (include_user) { user_perms_ .insert ( make_pair (iperm, uid)); }
897
897
}
898
898
// group_perms and user_perms are now ready for storing into the metadata index
899
899
}
0 commit comments