- if cache_acls.isUser(admin):
- return admin
- admin = 'system:' + admin
- try:
- if user in getafsgroups.getAfsGroupMembers(admin, config.authz[0].cell):
- return admin
- except getafsgroups.AfsProcessError, e:
- errmsg = str(e)
- if errmsg.startswith("pts: User or group doesn't exist"):
- errmsg = 'The group "%s" does not exist.' % admin
- raise InvalidInput('administrator', admin, errmsg)
- #XXX Should we require that user is in the admin group?
- return admin
+ if authz.expandAdmin('system:' + admin):
+ return 'system:' + admin
+ errmsg = 'No user "%s" or non-empty group "system:%s" found.' % (admin, admin)
+ else:
+ errmsg = 'No non-empty group "%s" found.' % (admin,)
+ raise InvalidInput('administrator', admin, errmsg)