Back

Can a non-owner of a team invite other members?

  • 0
  • Web
  • Cloud
kennyki
29 Jun, 2023, 17:14

In my application, I logged in as a member with the role of "admin" of a team (invited using an "owner" of the team). When trying to call teams.createMembership to create another member, i.e. of role "staff" it's throwing the error "User is not allowed to send invitations for this team".

Looking at the code at https://github.com/appwrite/appwrite/blob/1.1.x/app/controllers/api/teams.php#L320 and https://github.com/appwrite/appwrite/blob/1.1.x/src/Appwrite/Auth/Auth.php#L383, shouldn't the "admin" member considered as a privileged user?

TL;DR
The user is asking if a non-owner of a team can invite other members. The response suggests using user labels or creating a feature request for moderators-level in teams. It is mentioned that multiple owners can be assigned and given the owner role. The user questions if an app admin can invite members and is told it must be done with a function. The code is referenced to explain the permissions and privileged users. No solution is provided in the thread.
kennyki
29 Jun, 2023, 17:16

Can a non-owner of a team invite other members?

Binyamin
29 Jun, 2023, 17:21

The isPrivilegedUser function isn't relate to the end-user teams, but the current execution level. The admin in this function is it for the internal project team.

Binyamin
29 Jun, 2023, 17:21

The part that check if the current user is owner is here: https://github.com/appwrite/appwrite/blob/1.1.x/app/controllers/api/teams.php#L384

Binyamin
29 Jun, 2023, 17:21

This mean that any permission except owner will be treated the same.

kennyki
30 Jun, 2023, 01:13

I see

kennyki
30 Jun, 2023, 01:14

So.. in our applications, if we need to allow an app admin to invite members, it must be done with a function?

Binyamin
30 Jun, 2023, 01:14

You can give them the owner role

Binyamin
30 Jun, 2023, 01:14

You can have more then one owner

kennyki
30 Jun, 2023, 01:17

hmmm ok, I think that works, but that also means these app admins can delete the team

Binyamin
30 Jun, 2023, 01:17

Yep.

Binyamin
30 Jun, 2023, 01:18

The only other way would be through teams.

Binyamin
30 Jun, 2023, 01:18

If you think that the need to have moderators-level in team, then, I suggest to create an issue for that feature request

kennyki
30 Jun, 2023, 01:19

Alright, I'll first see what kind of workaround is possible. Otherwise will create a feature request

kennyki
30 Jun, 2023, 01:19

Thanks for your help!

Binyamin
30 Jun, 2023, 01:19

<a:agooglethumbsup:635256484682530825>

kennyki
30 Jun, 2023, 01:34

For future reference: I think the "User labels" Eldad mentioned in https://github.com/appwrite/appwrite/issues/4834#issuecomment-1574944467 may fit the use case

Binyamin
30 Jun, 2023, 01:34

I think this is roles, but, without teams

kennyki
30 Jun, 2023, 01:35

hmm ok, yeah that makes sense

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more