Filter out certian Roles

Was kinda hoping it would spark some ideas for you…

You need to grab the current user, then get role information using system.user.getUser()

userName = system.security.getUsername() # Get currently logged in user userIn = system.user.getUser("", userName) # Get User object from UserSource ("" is project default) rolesIn=userIn.roles # Get available roles (returns as list) if "Owner" in rolesIn: # Check if "Owner" is in the user's role list return 1 # returns everything elif "Management" in rolesIn: # Check if "Management" is in the user's role list if role=="Owner": return 0 # disallow "Owner" else: return 1 # allow everything else else: # Otherwise... return 0 # disallow everything

1 Like