#NEWLINE# def determine_user_rights( self , caller_hrn , reg_record ) : #NEWLINE# #INDENT# '\n        Given a user credential and a record, determine what set of rights the\n        user should have to that record.\n        \n        This is intended to replace determine_user_rights() and\n        verify_cancreate_credential()\n        ' #NEWLINE# rl = Rights ( ) #NEWLINE# type = reg_record . type #NEWLINE# if ( reg_record == 'slice' ) : #NEWLINE# #INDENT# researcher_hrns = [ user . hrn for user in reg_record . reg_researchers ] #NEWLINE# slice_pis = reg_record . get_pis ( ) #NEWLINE# pi_hrns = [ user . hrn for user in slice_pis ] #NEWLINE# if ( caller_hrn in ( researcher_hrns + pi_hrns ) ) : #NEWLINE# #INDENT# rl . add ( 'refresh' ) #NEWLINE# rl . add ( 'embed' ) #NEWLINE# rl . add ( 'bind' ) #NEWLINE# rl . add ( 'control' ) #NEWLINE# rl . add ( 'info' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( type == 'authority' ) : #NEWLINE# #INDENT# pi_hrns = [ user . hrn for user in reg_record . reg_pis ] #NEWLINE# if ( caller_hrn == self . config . SFA_INTERFACE_HRN ) : #NEWLINE# #INDENT# rl . add ( 'authority' ) #NEWLINE# rl . add ( 'sa' ) #NEWLINE# rl . add ( 'ma' ) #NEWLINE# #UNINDENT# if ( caller_hrn in pi_hrns ) : #NEWLINE# #INDENT# rl . add ( 'authority' ) #NEWLINE# rl . add ( 'sa' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( type == 'user' ) : #NEWLINE# #INDENT# rl . add ( 'refresh' ) #NEWLINE# rl . add ( 'resolve' ) #NEWLINE# rl . add ( 'info' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( type == 'node' ) : #NEWLINE# #INDENT# rl . add ( 'operator' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return rl