def _addAccountRights(sidObject, user_right):
 try:
  if sidObject:
   _polHandle = win32security.LsaOpenPolicy(None, win32security.POLICY_ALL_ACCESS)
   user_rights_list = [user_right]
   _ret = win32security.LsaAddAccountRights(_polHandle, sidObject, user_rights_list)
  return True
 except Exception as e:
  log.error('Error attempting to add account right, exception was {0}'.format(e))
  return False

def _addAccountRights ( sidObject , user_right ) : try : if sidObject : _polHandle = win32security . LsaOpenPolicy ( None , win32security . POLICY_ALL_ACCESS ) user_rights_list = [ user_right ] _ret = win32security . LsaAddAccountRights ( _polHandle , sidObject , user_rights_list ) return True except Exception as e : log . error ( 'Error attempting to add account right, exception was {0}' . format ( e ) ) return False
helper function to add an account right to a user .