Skip to content

Setting Gear Access Permissions

Introduction

By default, gears can be used by any user site-wide.  However, Site Administrators or Site Developers can limit gear access to designated users or projects.  The access permissions can be updated using the UI or via the SDK. Here we describe the SDK approach. For the UI based approach see Setting Gear Access.

A site admin or site developer can update the permissions of a specific gear. Permissions are set at the project or user level. Combinations and multiples are allowed. A permission of None will result in site-wide permissions, and is the default when a gear is first loaded.

Site Administrators or Gear Developers can set Gear access permissions using the following functions in the the Flywheel Python SDK. Using the SDK approach both Gear Developers and Site Admins have the ability to change permissions for users or projects using the user id or project id. Gear Developers can make this change to the gear permissions even though they are not assigned to the project.

Instruction Steps

In these examples, awesome-gear is an example gear name. user@flywheel.io is an example user id, 623b89fff383de7494a88e66 is an example project id, and research is an example group id.

  • Check existing permissions on the gear
fw.get_gear_series("awesome-gear")
fw.replace_gear_permissions("awesome-gear",{"users" : ['user@flywheel.io']})
  • Remove any restrictions on the gear, setting the gear permissions to default(None)
fw.delete_gear_permissions('awesome-gear')
  • Add another user to the “awesome-gear”
fw.add_gear_permission("awesome-gear", "users", {"id":"user@flywheel.io"})
  • For project level permissions, the same commands apply, but the input becomes:
fw.replace_gear_permission("awesome-gear", "users", {"id":"user@flywheel.io"}, "projects", {"id":"623b89fff383de7494a88e66"})
  • To remove all permissions and make a gear inaccessible by users, provide empty lists:
fw.replace_gear_permissions("awesome-gear",{"users" : [], 'projects': []})