-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored to removed unused classes
Added support for multi assignment
- Loading branch information
Matthew Fortunka
committed
Feb 19, 2025
1 parent
fee832a
commit d18a392
Showing
8 changed files
with
78 additions
and
83 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
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,29 @@ | ||
from typing import List | ||
from pydantic import BaseModel, Field | ||
from enum import Enum | ||
|
||
class AssignableUser(BaseModel): | ||
id: str | ||
displayName: str | ||
userPrincipalName: str | ||
|
||
class AssignmentType(Enum): | ||
APP_ROLE = "ApplicationRole" | ||
GROUP = "Group" | ||
|
||
class Role(BaseModel): | ||
id: str | ||
displayName: str | ||
type: AssignmentType | ||
|
||
def __eq__(self, other): | ||
return self.id == other.id | ||
|
||
def __hash__(self): | ||
return hash(self.id) | ||
|
||
class AssignedUser(BaseModel): | ||
id: str | ||
displayName: str | ||
userPrincipalName: str | ||
roles: List[Role] = Field([]) |
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,15 @@ | ||
from typing import List | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class UserRoleAssignmentRequest(BaseModel): | ||
role_id: str = Field(title="Role Id", description="Role to assign users to") | ||
user_ids: List[str] = Field([], title="List of User Ids", description="List of User Ids to assign the role to") | ||
|
||
class Config: | ||
schema_extra = { | ||
"example": { | ||
"role_id": "1234", | ||
"user_ids": ["1", "2"] | ||
} | ||
} |
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