From 88e18f08d4117988a2050c83d66cb2608f96ab4d Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Fri, 21 Jun 2024 15:49:25 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20isDelegatedAdming=20to=20goog?= =?UTF-8?q?le=20workspace=20users=20(#4283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivan Milchev --- .../google-workspace/resources/google-workspace.lr | 2 ++ .../resources/google-workspace.lr.go | 12 ++++++++++++ .../resources/google-workspace.lr.manifest.yaml | 1 + providers/google-workspace/resources/users.go | 1 + 4 files changed, 16 insertions(+) diff --git a/providers/google-workspace/resources/google-workspace.lr b/providers/google-workspace/resources/google-workspace.lr index 69a53fcd12..70204b3291 100644 --- a/providers/google-workspace/resources/google-workspace.lr +++ b/providers/google-workspace/resources/google-workspace.lr @@ -70,6 +70,8 @@ private googleworkspace.user @defaults("primaryEmail") { archived bool // Indicates a user with super administrator privileges isAdmin bool + // Indicates if a user is a delegated administrator + isDelegatedAdmin bool // Is 2-step verification enforced isEnforcedIn2Sv bool // Is enrolled in 2-step verification diff --git a/providers/google-workspace/resources/google-workspace.lr.go b/providers/google-workspace/resources/google-workspace.lr.go index 43728c5392..9a3f4809a5 100644 --- a/providers/google-workspace/resources/google-workspace.lr.go +++ b/providers/google-workspace/resources/google-workspace.lr.go @@ -216,6 +216,9 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "googleworkspace.user.isAdmin": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlGoogleworkspaceUser).GetIsAdmin()).ToDataRes(types.Bool) }, + "googleworkspace.user.isDelegatedAdmin": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlGoogleworkspaceUser).GetIsDelegatedAdmin()).ToDataRes(types.Bool) + }, "googleworkspace.user.isEnforcedIn2Sv": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlGoogleworkspaceUser).GetIsEnforcedIn2Sv()).ToDataRes(types.Bool) }, @@ -516,6 +519,10 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlGoogleworkspaceUser).IsAdmin, ok = plugin.RawToTValue[bool](v.Value, v.Error) return }, + "googleworkspace.user.isDelegatedAdmin": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlGoogleworkspaceUser).IsDelegatedAdmin, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, "googleworkspace.user.isEnforcedIn2Sv": func(r plugin.Resource, v *llx.RawData) (ok bool) { r.(*mqlGoogleworkspaceUser).IsEnforcedIn2Sv, ok = plugin.RawToTValue[bool](v.Value, v.Error) return @@ -1087,6 +1094,7 @@ type mqlGoogleworkspaceUser struct { SuspensionReason plugin.TValue[string] Archived plugin.TValue[bool] IsAdmin plugin.TValue[bool] + IsDelegatedAdmin plugin.TValue[bool] IsEnforcedIn2Sv plugin.TValue[bool] IsEnrolledIn2Sv plugin.TValue[bool] IsMailboxSetup plugin.TValue[bool] @@ -1185,6 +1193,10 @@ func (c *mqlGoogleworkspaceUser) GetIsAdmin() *plugin.TValue[bool] { return &c.IsAdmin } +func (c *mqlGoogleworkspaceUser) GetIsDelegatedAdmin() *plugin.TValue[bool] { + return &c.IsDelegatedAdmin +} + func (c *mqlGoogleworkspaceUser) GetIsEnforcedIn2Sv() *plugin.TValue[bool] { return &c.IsEnforcedIn2Sv } diff --git a/providers/google-workspace/resources/google-workspace.lr.manifest.yaml b/providers/google-workspace/resources/google-workspace.lr.manifest.yaml index 4d7a2c2df0..a6fbf912c7 100755 --- a/providers/google-workspace/resources/google-workspace.lr.manifest.yaml +++ b/providers/google-workspace/resources/google-workspace.lr.manifest.yaml @@ -126,6 +126,7 @@ resources: givenName: {} id: {} isAdmin: {} + isDelegatedAdmin: {} isEnforcedIn2Sv: {} isEnrolledIn2Sv: {} isMailboxSetup: {} diff --git a/providers/google-workspace/resources/users.go b/providers/google-workspace/resources/users.go index b92bbe7ff6..451094f19d 100644 --- a/providers/google-workspace/resources/users.go +++ b/providers/google-workspace/resources/users.go @@ -79,6 +79,7 @@ func newMqlGoogleWorkspaceUser(runtime *plugin.Runtime, entry *directory.User) ( "suspensionReason": llx.StringData(entry.SuspensionReason), "archived": llx.BoolData(entry.Archived), "isAdmin": llx.BoolData(entry.IsAdmin), + "isDelegatedAdmin": llx.BoolData(entry.IsDelegatedAdmin), "isEnforcedIn2Sv": llx.BoolData(entry.IsEnforcedIn2Sv), "isEnrolledIn2Sv": llx.BoolData(entry.IsEnrolledIn2Sv), "isMailboxSetup": llx.BoolData(entry.IsMailboxSetup),