Jump to content

Add user to project team using python API


alexisp

Recommended Posts

Hi,

I'm trying to push users and user assignments from our internal system to ftrack. I'm probably missing something. Based on how it works for assigning users on tasks I'm tempted to do something like this, but obviously this is not it 😅

 

session.create('Membership', {
  'context': ftrack_project,
  'resource': ftrack_user,
  'type': 'membership'
})

 

Any pointers ?

Cheers,

Alexis

Link to comment
Share on other sites

Okay so, I managed to  create an "Appointment" object of type "allocation"

session.create('Appointment', {
  'context': ftrack_proj,
  'resource': ftrack_user,
  'type': 'allocation'
})

But it does not show up in when I try to list the user of the project 🤔

for allocation in ftrack_proj['allocations']:
    resource = allocation['resource']
    if isinstance(resource, session.types['User']):
        print(resource['username'])

And when I switch the project to private, the "allocations" attributes becomes None 🤨


I got to say the data model is a bit confusing here 😅

Any tips ? 🙃

Link to comment
Share on other sites

  • 2 weeks later...

Ah yes, I see !

It took a bit of playing around to manage that (as you cant grant access to a project that is not private yet).

I will retry and let you know, but this means the "team" behavior is completely different between "open" and "private" mode ?

 

Also I don't really get the difference between "project access" and "organize team". I dont get why do I have people in the team that dont appear in the access list 🤔

image.png.08bde0f62cb4798f444e40c9f62fb20f.png          image.png.8b3ca3d026d03d0aed85164afaf19189.png

 

Thx,

Alexis

Link to comment
Share on other sites

Hi Alexis,

The 'organize team' tab serves a couple of functions.  it allows you to create project-specific groups.  it is also the list of people who can be assigned tasks on that project.  when left blank ALL users in the system show up in the drop-down list.  Only those users who are added to the 'organize team' tab can be assigned to tasks from the drop-down.

the 'project access' tab is as it sounds. It controls who has access to the project. sometimes you may have users who you want access to the project but you do not want them assigned to any work.

It is also worth noting that project access differs depending on how your roles are set up.  I want to be clear here that "PRIVATE PROJECTS" are a feature designed to be closer to "Air gapped" within your ftrack workspace.  ONLY users who are EXPLICITLY added to a private project can access that project including administrators and API users.  If you want to have some users with overall visibility on all projects then we recommend using open projects and controlling access to those projects through the Roles and project access.

I hope that helps clear it up a little.  Please let us know if you have any other questions.

regards,

Daniel

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...