Improve `Member.add_user`
As discussed in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/744#note_16498240, we should improve Member.add_user
in several possible ways/steps:
- Rename the
current_user
keyword argument toadded_by
which is more explicit. - Enforce permission check and disallow update/create/approval of members if
current_user
/added_by
is not provided - Maybe change the current check which is
update_xxx_member
toadmin_xxx_member
? It feels weird to only checkupdate_xxx_member
even when the method can actually create members => we could even rename the method, split it in two, or check different permission depending on if the member already exists or not... - In EE: remove the comments added in gitlab-ce@198b6700f715e50cc4da510fe351858c5abb03c0 once the code is clearer.
- Also, I think it may be beneficial in order to avoid conflicts to have the same signature for
Member.add_user
in CE and in EE (currently the EE version takes aldap: false
keyword argument).