Skip to content

Commit

Permalink
Merge pull request #188 from Azure/admin-users-fix
Browse files Browse the repository at this point in the history
Admin Users Fix
  • Loading branch information
DCMattyG authored Oct 10, 2023
2 parents 2571910 + b37ea4f commit 71c7d09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,13 @@ class Admin(BaseModel):
name: str
email: Optional[EmailStr] = None
id: UUID

@model_validator(mode='before')
@classmethod
def check_email(cls, data: Any) -> Any:
if isinstance(data, dict):
if 'type' in data and 'email' in data:
if data['type'] == "Principal":
if data['type'] == "Principal" and data['email'] is not None:
raise ValueError("email should not be set for 'principal' type")
if 'type' in data and 'email' not in data:
if data['type'] == "User":
Expand Down

0 comments on commit 71c7d09

Please sign in to comment.