diff --git a/providers/ms365/resources/groups.go b/providers/ms365/resources/groups.go index 2a16bbc25b..b218b5d348 100644 --- a/providers/ms365/resources/groups.go +++ b/providers/ms365/resources/groups.go @@ -12,6 +12,7 @@ import ( "go.mondoo.com/cnquery/v11/llx" "go.mondoo.com/cnquery/v11/providers/ms365/connection" + "go.mondoo.com/cnquery/v11/types" ) func (m *mqlMicrosoftGroup) id() (string, error) { @@ -48,13 +49,16 @@ func (a *mqlMicrosoft) groups() ([]interface{}, error) { for _, grp := range grps { graphGrp, err := CreateResource(a.MqlRuntime, "microsoft.group", map[string]*llx.RawData{ - "id": llx.StringDataPtr(grp.GetId()), - "displayName": llx.StringDataPtr(grp.GetDisplayName()), - "mail": llx.StringDataPtr(grp.GetMail()), - "mailEnabled": llx.BoolDataPtr(grp.GetMailEnabled()), - "mailNickname": llx.StringDataPtr(grp.GetMailNickname()), - "securityEnabled": llx.BoolDataPtr(grp.GetSecurityEnabled()), - "visibility": llx.StringDataPtr(grp.GetVisibility()), + "id": llx.StringDataPtr(grp.GetId()), + "displayName": llx.StringDataPtr(grp.GetDisplayName()), + "mail": llx.StringDataPtr(grp.GetMail()), + "mailEnabled": llx.BoolDataPtr(grp.GetMailEnabled()), + "mailNickname": llx.StringDataPtr(grp.GetMailNickname()), + "securityEnabled": llx.BoolDataPtr(grp.GetSecurityEnabled()), + "visibility": llx.StringDataPtr(grp.GetVisibility()), + "groupTypes": llx.ArrayData(llx.TArr2Raw(grp.GetGroupTypes()), types.String), + "membershipRule": llx.StringDataPtr(grp.GetMembershipRule()), + "membershipRuleProcessingState": llx.StringDataPtr(grp.GetMembershipRuleProcessingState()), }) if err != nil { return nil, err diff --git a/providers/ms365/resources/ms365.lr b/providers/ms365/resources/ms365.lr index b8667e980a..6fbed71bd2 100644 --- a/providers/ms365/resources/ms365.lr +++ b/providers/ms365/resources/ms365.lr @@ -108,6 +108,12 @@ private microsoft.group @defaults("id displayName") { visibility string // List of group members members() []microsoft.user + // Group types indicating the membership and classification of the group + groupTypes []string + // Membership rule used for dynamic group membership + membershipRule string + // State of the processing for the dynamic membership rule + membershipRuleProcessingState string } // Microsoft domain diff --git a/providers/ms365/resources/ms365.lr.go b/providers/ms365/resources/ms365.lr.go index a3aa60b726..ba0fac0a65 100644 --- a/providers/ms365/resources/ms365.lr.go +++ b/providers/ms365/resources/ms365.lr.go @@ -325,6 +325,15 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "microsoft.group.members": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlMicrosoftGroup).GetMembers()).ToDataRes(types.Array(types.Resource("microsoft.user"))) }, + "microsoft.group.groupTypes": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMicrosoftGroup).GetGroupTypes()).ToDataRes(types.Array(types.String)) + }, + "microsoft.group.membershipRule": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMicrosoftGroup).GetMembershipRule()).ToDataRes(types.String) + }, + "microsoft.group.membershipRuleProcessingState": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMicrosoftGroup).GetMembershipRuleProcessingState()).ToDataRes(types.String) + }, "microsoft.domain.id": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlMicrosoftDomain).GetId()).ToDataRes(types.String) }, @@ -950,6 +959,18 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlMicrosoftGroup).Members, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) return }, + "microsoft.group.groupTypes": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMicrosoftGroup).GroupTypes, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) + return + }, + "microsoft.group.membershipRule": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMicrosoftGroup).MembershipRule, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "microsoft.group.membershipRuleProcessingState": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMicrosoftGroup).MembershipRuleProcessingState, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, "microsoft.domain.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { r.(*mqlMicrosoftDomain).__id, ok = v.Value.(string) return @@ -2033,6 +2054,9 @@ type mqlMicrosoftGroup struct { Mail plugin.TValue[string] Visibility plugin.TValue[string] Members plugin.TValue[[]interface{}] + GroupTypes plugin.TValue[[]interface{}] + MembershipRule plugin.TValue[string] + MembershipRuleProcessingState plugin.TValue[string] } // createMicrosoftGroup creates a new instance of this resource @@ -2116,6 +2140,18 @@ func (c *mqlMicrosoftGroup) GetMembers() *plugin.TValue[[]interface{}] { }) } +func (c *mqlMicrosoftGroup) GetGroupTypes() *plugin.TValue[[]interface{}] { + return &c.GroupTypes +} + +func (c *mqlMicrosoftGroup) GetMembershipRule() *plugin.TValue[string] { + return &c.MembershipRule +} + +func (c *mqlMicrosoftGroup) GetMembershipRuleProcessingState() *plugin.TValue[string] { + return &c.MembershipRuleProcessingState +} + // mqlMicrosoftDomain for the microsoft.domain resource type mqlMicrosoftDomain struct { MqlRuntime *plugin.Runtime diff --git a/providers/ms365/resources/ms365.lr.manifest.yaml b/providers/ms365/resources/ms365.lr.manifest.yaml index 75b6819bb0..b099bcdfab 100755 --- a/providers/ms365/resources/ms365.lr.manifest.yaml +++ b/providers/ms365/resources/ms365.lr.manifest.yaml @@ -92,11 +92,17 @@ resources: microsoft.group: fields: displayName: {} + groupTypes: + min_mondoo_version: 9.0.0 id: {} mail: {} mailEnabled: {} mailNickname: {} members: {} + membershipRule: + min_mondoo_version: 9.0.0 + membershipRuleProcessingState: + min_mondoo_version: 9.0.0 securityEnabled: {} visibility: min_mondoo_version: 9.0.0