What is the proper way to limit the permissions for an App via the info.yml file? Does deny_permissions work for register_commands? This code here doesn’t seem to restrict the app from launching for a Developer:
params = {
"title": menu_name,
"short_name": short_name,
"deny_permissions": ['Developer'],
"deny_platforms": deny_platforms,
}
# now register the command with the engine
self.engine.register_command(menu_name, menu_callback, params)
I can’t find any clear documentation on restricting permissions for an App to certain permission groups.
Thanks,
So following up on this: “deny_permissions” works in the shotgun engine, but not in desktop engine. So my question is simply: How do I control who can or cannot see a non-software desktop app?
Adding this code to app.py will allow you to check the user permission, and only register the app if the user permission is not in “deny_permissions” from the info.yml.
# Initialize shotgun
sg = self.shotgun
# Get context, user from app
ctx = self.context.to_dict()
user = ctx["user"]
# If it's a human user, get the permission
if user != None and user["type"] == "HumanUser":
user_info = sg.find_one("HumanUser",[["id","is",user["id"]]],["permission_rule_set"])
user_permission = user_info["permission_rule_set"]["name"]
# If user_permission not in deny_permissions, allow app to load
if user_permission not in deny_permissions:
# now register the command with the engine
self.engine.register_command(menu_name, menu_callback, params)