Restrict Toolkit Apps

Is there a way to control which Toolkit Apps display under which Projects in SG Desktop? Say I have an app “Create Tickets” that I only want to display for certain Projects. I know I could create a Pipeline Config that is restricted to a specific Project. But, is there an easier way to do it without having to create a bunch of Pipeline Configs just to organize the Desktop UI.

1 Like

Hi,

I don’t know exactly how your setup looks like, but we have some apps that are “restricted” to specific users, you could do something similar but for projects instead.

We’re using uploaded apps and have added an extra field to the Toolkit App entity called User restrictions where we can add users that should have access to the app. Here you could use project instead of users.

Then I just put a bit of code in the app.py files init_app method:

# Check if we have user restrictions, and if we have, check if current user should have access to this app
filters = [['id', 'is', 101]]
fields = ["sg_users_restrictions"]
this_app = self.shotgun.find_one("CustomNonProjectEntity04", filters, fields)
user_restrictions = this_app["sg_users_restrictions"]
id_list = []
if len(user_restrictions) == 0:
    pass
else:
    for user in user_restrictions:
        id_list.append(user["id"])

    current_user_id = self.context.user["id"]
    if current_user_id in id_list:
        pass
    else:
        return

I have hardcoded the id for the current app, there’s probably a more elegant way of finding that out. But basically I just make a query to find the app and then checking if the current user is added to the User Restrictions field.

It’s a bit “hacky” and would be nice if there was a standardized way of dealing with project/user access. But it works for us!

All best,
Jonas

5 Likes

Hey @mharris – To add to what @jonas.lindfors suggested, there’s actually a Project field on Software entities in Shotgun. If it has a value, only the projects specified there will be able to see the given Software.

It’s documented in our Admin Guide.

1 Like