-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#26 - adding user management features.
* Adding signals * User listings via MultiTenantCompany queries * Invite and accept invitations for users * adding tests --------- Co-authored-by: Sascha Dobbelaere <sascha@tweave.tech>
- Loading branch information
1 parent
a7f9283
commit 5016320
Showing
18 changed files
with
462 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ htmlcov/ | |
.cache | ||
nosetests.xml | ||
coverage.xml | ||
coverage.json | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .mutation_type import MultiTenantMutation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from core.schema.multi_tenant.types.input import MultiTenantCompanyMyInput, \ | ||
MultiTenantCompanyPartialInput, MultiTenantUserPartialInput, \ | ||
MultiTenantUserInput, MultiTenantInviteUserInput, MultiTenantUserAcceptInviteInput, \ | ||
MultiTenantUserStatusInput | ||
from core.schema.core.mutations import IsAuthenticated, default_extensions | ||
from .mutation_classes import MyMultiTenantCompanyCreateMutation, \ | ||
MyMultiTentantCompanyUpdateMutation, UpdateMeMutation, \ | ||
RegisterUserMutation, InviteUserMutation, AcceptInvitationMutation, \ | ||
EnableUserMutation, DisableUserMutation | ||
|
||
|
||
def register_my_multi_tenant_company(): | ||
extensions = [IsAuthenticated()] | ||
return MyMultiTenantCompanyCreateMutation(MultiTenantCompanyMyInput, extensions=extensions) | ||
|
||
|
||
def update_my_multi_tenant_company(): | ||
extensions = default_extensions | ||
return MyMultiTentantCompanyUpdateMutation(MultiTenantCompanyPartialInput, extensions=extensions) | ||
|
||
|
||
def update_me(): | ||
extensions = default_extensions | ||
return UpdateMeMutation(MultiTenantUserPartialInput, extensions=extensions) | ||
|
||
|
||
def register_user(): | ||
extensions = [] | ||
return RegisterUserMutation(MultiTenantUserInput, extensions=extensions) | ||
|
||
|
||
def invite_user(): | ||
extensions = default_extensions | ||
return InviteUserMutation(MultiTenantInviteUserInput, extensions=extensions) | ||
|
||
|
||
def accept_user_invitation(): | ||
extensions = [] | ||
return AcceptInvitationMutation(MultiTenantUserAcceptInviteInput, extensions=extensions) | ||
|
||
|
||
def disable_user(): | ||
extensions = default_extensions | ||
return DisableUserMutation(MultiTenantUserStatusInput, extensions=extensions) | ||
|
||
|
||
def enable_user(): | ||
extensions = default_extensions | ||
return EnableUserMutation(MultiTenantUserStatusInput, extensions=extensions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
OneSila/core/schema/multi_tenant/mutations/mutation_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from core.schema.core.mutations import type | ||
from strawberry_django import auth as strawberry_auth | ||
from .fields import register_user, register_my_multi_tenant_company, \ | ||
update_me, update_my_multi_tenant_company, invite_user, \ | ||
accept_user_invitation, disable_user, enable_user | ||
|
||
from core.schema.multi_tenant.types.types import MultiTenantUserType, \ | ||
MultiTenantCompanyType | ||
|
||
|
||
@type(name="Mutation") | ||
class MultiTenantMutation: | ||
login: MultiTenantUserType = strawberry_auth.login() | ||
logout = strawberry_auth.logout() | ||
|
||
register_user: MultiTenantUserType = register_user() | ||
register_my_multi_tenant_company: MultiTenantCompanyType = register_my_multi_tenant_company() | ||
|
||
update_me: MultiTenantUserType = update_me() | ||
update_my_multi_tenant_company: MultiTenantCompanyType = update_my_multi_tenant_company() | ||
|
||
invite_user: MultiTenantUserType = invite_user() | ||
accept_user_invitation: MultiTenantUserType = accept_user_invitation() | ||
|
||
disable_user: MultiTenantUserType = disable_user() | ||
enable_user: MultiTenantUserType = enable_user() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
from core.schema.types.types import auto | ||
from core.schema.types.filters import filter | ||
from core.schema.core.types.types import auto | ||
from core.schema.core.types.filters import filter | ||
|
||
from core.models.multi_tenant import MultiTenantCompany, MultiTenantUser | ||
|
||
|
||
@filter(MultiTenantUser) | ||
class MultiTenantUserFilter: | ||
first_name: auto | ||
last_name: auto | ||
username: auto | ||
is_active: auto | ||
invitation_accepted: auto | ||
is_multi_tenant_company_owner: auto |
Oops, something went wrong.