File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,41 @@ def show_group_identifiers(gid):
248
248
249
249
# fixup functions
250
250
251
+ def add_project_identifier_to_group (gid , project_name ):
252
+ identifier_name = "Yes-%s" % project_name
253
+ type_ = "ospoolproject"
254
+ return add_identifier_to_group (gid , type_ , identifier_name )
255
+
256
+
257
+ def add_identifier_to_group (gid , type_ , identifier_name ):
258
+ new_identifier_info = {
259
+ "Version" : "1.0" ,
260
+ "Type" : type_ ,
261
+ "Identifier" : identifier_name ,
262
+ "Login" : False ,
263
+ "Person" : {"Type" : "Group" , "Id" : str (gid )},
264
+ "Status" : "Active"
265
+ }
266
+ data = {
267
+ "RequestType" : "Identifiers" ,
268
+ "Version" : "1.0" ,
269
+ "Identifiers" : [new_identifier_info ]
270
+ }
271
+ return call_api3 (POST , "identifiers.json" , data )
272
+
273
+
274
+ def gname_to_gid (gname ):
275
+ groups = get_osg_co_groups () | get_datalist ("CoGroups" )
276
+ matching = [ g for g in groups if g ["Name" ] == gname ]
277
+
278
+ if len (matching ) > 1 :
279
+ raise RuntimeError ("Multiple groups found with Name '%s'" % gname )
280
+ elif not matching :
281
+ raise RuntimeError ("No group found with Name '%s'" % gname )
282
+
283
+ group = matching [0 ]
284
+ return group ["Id" ]
285
+
251
286
252
287
def delete_identifier (id_ ):
253
288
return call_api2 (DELETE , "identifiers/%d.json" % id_ )
You can’t perform that action at this time.
0 commit comments