Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(/internal): Add User Resource Owner #9168

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Feat(/internal): Add User Resource
Owner

Update the  ../proto/zitadel/member.proto to
include the UserResourceOwner as part of member.

Update the queries to include UserResourceOwner
for the following :
zitadel/internal/query/iam_member.go
zitadel/internal/query/org_member.go
zitadel/internal/query/project_member.go
zitadel/internal/query/project_grant_member.go

Non Breaking Changes
  • Loading branch information
MAHANTH-wq authored Jan 14, 2025
commit 61a08b6a3e501e4a51036ee6b71fd0f41c11186e
1 change: 1 addition & 0 deletions internal/api/grpc/member/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func MemberToPb(assetAPIPrefix string, m *query.Member) *member_pb.Member {
m.ChangeDate,
m.ResourceOwner,
),
UserResourceOwner: m.UserResourceOwner,
}
}

Expand Down
6 changes: 6 additions & 0 deletions internal/query/iam_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ var (
name: projection.MemberResourceOwner,
table: instanceMemberTable,
}
InstanceMemberUserResourceOwner = Column{
name: projection.MemberUserResourceOwner,
table: instanceMemberTable,
}
InstanceMemberInstanceID = Column{
name: projection.MemberInstanceID,
table: instanceMemberTable,
Expand Down Expand Up @@ -96,6 +100,7 @@ func prepareInstanceMembersQuery(ctx context.Context, db prepareDatabase) (sq.Se
InstanceMemberChangeDate.identifier(),
InstanceMemberSequence.identifier(),
InstanceMemberResourceOwner.identifier(),
InstanceMemberUserResourceOwner.identifier(),
InstanceMemberUserID.identifier(),
InstanceMemberRoles.identifier(),
LoginNameNameCol.identifier(),
Expand Down Expand Up @@ -138,6 +143,7 @@ func prepareInstanceMembersQuery(ctx context.Context, db prepareDatabase) (sq.Se
&member.ChangeDate,
&member.Sequence,
&member.ResourceOwner,
&member.UserResourceOwner,
&member.UserID,
&member.Roles,
&preferredLoginName,
Expand Down
10 changes: 5 additions & 5 deletions internal/query/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ type Members struct {
}

type Member struct {
CreationDate time.Time
ChangeDate time.Time
Sequence uint64
ResourceOwner string

CreationDate time.Time
ChangeDate time.Time
Sequence uint64
ResourceOwner string
UserResourceOwner string
UserID string
Roles database.TextArray[string]
PreferredLoginName string
Expand Down
6 changes: 6 additions & 0 deletions internal/query/org_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ var (
name: projection.MemberResourceOwner,
table: orgMemberTable,
}
OrgMemberUserResourceOwner = Column{
name: projection.MemberUserResourceOwner,
table: orgMemberTable,
}
OrgMemberInstanceID = Column{
name: projection.MemberInstanceID,
table: orgMemberTable,
Expand Down Expand Up @@ -99,6 +103,7 @@ func prepareOrgMembersQuery(ctx context.Context, db prepareDatabase) (sq.SelectB
OrgMemberChangeDate.identifier(),
OrgMemberSequence.identifier(),
OrgMemberResourceOwner.identifier(),
OrgMemberUserResourceOwner.identifier(),
OrgMemberUserID.identifier(),
OrgMemberRoles.identifier(),
LoginNameNameCol.identifier(),
Expand Down Expand Up @@ -141,6 +146,7 @@ func prepareOrgMembersQuery(ctx context.Context, db prepareDatabase) (sq.SelectB
&member.ChangeDate,
&member.Sequence,
&member.ResourceOwner,
&member.UserResourceOwner,
&member.UserID,
&member.Roles,
&preferredLoginName,
Expand Down
6 changes: 6 additions & 0 deletions internal/query/project_grant_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ var (
name: projection.MemberResourceOwner,
table: projectGrantMemberTable,
}
ProjectGrantMemberUserResourceOwner = Column{
name: projection.MemberUserResourceOwner,
table: projectGrantMemberTable,
}
ProjectGrantMemberInstanceID = Column{
name: projection.MemberInstanceID,
table: projectGrantMemberTable,
Expand Down Expand Up @@ -108,6 +112,7 @@ func prepareProjectGrantMembersQuery(ctx context.Context, db prepareDatabase) (s
ProjectGrantMemberChangeDate.identifier(),
ProjectGrantMemberSequence.identifier(),
ProjectGrantMemberResourceOwner.identifier(),
ProjectGrantMemberUserResourceOwner.identifier(),
ProjectGrantMemberUserID.identifier(),
ProjectGrantMemberRoles.identifier(),
LoginNameNameCol.identifier(),
Expand Down Expand Up @@ -151,6 +156,7 @@ func prepareProjectGrantMembersQuery(ctx context.Context, db prepareDatabase) (s
&member.ChangeDate,
&member.Sequence,
&member.ResourceOwner,
&member.UserResourceOwner,
&member.UserID,
&member.Roles,
&preferredLoginName,
Expand Down
6 changes: 6 additions & 0 deletions internal/query/project_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ var (
name: projection.MemberResourceOwner,
table: projectMemberTable,
}
ProjectMemberUserResourceOwner = Column{
name: projection.MemberUserResourceOwner,
table: projectMemberTable,
}
ProjectMemberInstanceID = Column{
name: projection.MemberInstanceID,
table: projectMemberTable,
Expand Down Expand Up @@ -99,6 +103,7 @@ func prepareProjectMembersQuery(ctx context.Context, db prepareDatabase) (sq.Sel
ProjectMemberChangeDate.identifier(),
ProjectMemberSequence.identifier(),
ProjectMemberResourceOwner.identifier(),
ProjectMemberUserResourceOwner.identifier(),
ProjectMemberUserID.identifier(),
ProjectMemberRoles.identifier(),
LoginNameNameCol.identifier(),
Expand Down Expand Up @@ -141,6 +146,7 @@ func prepareProjectMembersQuery(ctx context.Context, db prepareDatabase) (sq.Sel
&member.ChangeDate,
&member.Sequence,
&member.ResourceOwner,
&member.UserResourceOwner,
&member.UserID,
&member.Roles,
&preferredLoginName,
Expand Down
8 changes: 8 additions & 0 deletions proto/zitadel/member.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ message Member {
description: "type of the user (human / machine)"
}
];

//resource_owner is the organization an object belongs to
MAHANTH-wq marked this conversation as resolved.
Show resolved Hide resolved
string user_resource_owner = 11 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629023906488334\"";
}
];

}

message SearchQuery {
Expand Down