Skip to content

Commit c0e2250

Browse files
authored
Merge pull request #640 from smoy/feat/2-step-verification
(Google Workspace) Expand data model to capture two-step verification and admin status
2 parents cfeef7d + 47eb9c0 commit c0e2250

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

iambic/plugins/v0_1_0/google_workspace/iambic_plugin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,13 @@ def get_google_templates():
123123
from iambic.plugins.v0_1_0.google_workspace.group.models import (
124124
GoogleWorkspaceGroupTemplate,
125125
)
126+
from iambic.plugins.v0_1_0.google_workspace.user.models import (
127+
GoogleWorkspaceUserTemplate,
128+
)
126129

127130
return [
128131
GoogleWorkspaceGroupTemplate,
132+
GoogleWorkspaceUserTemplate,
129133
]
130134

131135

iambic/plugins/v0_1_0/google_workspace/user/models.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@ class WorkspaceUser(BaseModel, ExpiryModel):
4545
description="Holds the given and family names of the user, and the read-only fullName value. The maximum number of characters in the givenName and in the familyName values is 60. In addition, name values support unicode/UTF-8 characters, and can contain spaces, letters (a-z), numbers (0-9), dashes (-), forward slashes (/), and periods (.). For more information about character usage rules, see the administration help center. Maximum allowed data size for this field is 1KB.",
4646
)
4747

48+
is_enrolled_in_two_step_verification: Optional[bool] = Field(
49+
alias="isEnrolledIn2Sv",
50+
description="Output only. Is enrolled in 2-step verification (Read-only)",
51+
)
52+
53+
is_enforced_in_two_step_verification: Optional[bool] = Field(
54+
alias="isEnforcedIn2Sv",
55+
description="Output only. Is enrolled in 2-step verification (Read-only)",
56+
)
57+
58+
is_admin: Optional[bool] = Field(
59+
alias="isAdmin",
60+
description="Output only. Indicates a user with super admininistrator privileges. The isAdmin property can only be edited in the Make a user an administrator operation ( makeAdmin method). If edited in the user insert or update methods, the edit is ignored by the API service.",
61+
)
62+
63+
is_delegated_admin: Optional[bool] = Field(
64+
alias="isDelegatedAdmin",
65+
description="Output only. Indicates if the user is a delegated administrator. Delegated administrators are supported by the API but cannot create or undelete users, or make users administrators. These requests are ignored by the API service. Roles and privileges for administrators are assigned using the Admin console.",
66+
)
67+
68+
suspended: Optional[bool] = Field(
69+
description="Indicates if user is suspended.",
70+
)
71+
4872
domain: str = Field(
4973
description="this is not direct from user object from google response, but since user maps to a domain, we need to keep track of this information",
5074
)
@@ -95,11 +119,15 @@ async def get_user_template(
95119
# members = await get_group_members(service, group)
96120

97121
file_name = f"{user['primaryEmail'].split('@')[0]}.yaml"
122+
123+
user_properties = dict(
124+
domain=domain,
125+
name=user["name"],
126+
primary_email=user["primaryEmail"],
127+
)
128+
user_properties.update(**user)
129+
98130
return GoogleWorkspaceUserTemplate(
99131
file_path=f"resources/google/users/{domain}/{file_name}",
100-
properties=dict(
101-
domain=domain,
102-
name=user["name"],
103-
primary_email=user["primaryEmail"],
104-
),
132+
properties=user_properties,
105133
)

0 commit comments

Comments
 (0)