Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 0 additions & 20 deletions core/serviceuser/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,6 @@ func (s Service) Create(ctx context.Context, serviceUser ServiceUser) (ServiceUs
return ServiceUser{}, err
}

if len(serviceUser.CreatedByUser) > 0 {
// TODO: write authz tests that checks if the user who created the service user
// has the permission to interact with the service user
// attach user to service user who created it
_, err = s.relationService.Create(ctx, relation.Relation{
Object: relation.Object{
ID: createdSU.ID,
Namespace: schema.ServiceUserPrincipal,
},
Subject: relation.Subject{
ID: serviceUser.CreatedByUser,
Namespace: schema.UserPrincipal,
},
RelationName: schema.UserRelationName,
})
if err != nil {
return ServiceUser{}, err
}
}

return createdSU, nil
}

Expand Down
4 changes: 0 additions & 4 deletions core/serviceuser/serviceuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ type ServiceUser struct {
State string
Metadata metadata.Metadata

// CreatedByUser is a transient field that is used to track the user who created this service user
// this doesn't have any impact on the service user itself
CreatedByUser string

CreatedAt time.Time
UpdatedAt time.Time
}
Expand Down
3 changes: 1 addition & 2 deletions internal/bootstrap/schema/base_schema.zed
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ definition app/user {}

definition app/serviceuser {
relation org: app/organization
relation user: app/user

permission manage = org->serviceusermanage + user
permission manage = org->serviceusermanage
}

definition app/pat {
Expand Down
3 changes: 1 addition & 2 deletions internal/bootstrap/testdata/compiled_schema.zed
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ definition app/rolebinding {
}

definition app/serviceuser {
permission manage = org->serviceusermanage + user
permission manage = org->serviceusermanage
relation org: app/organization
relation user: app/user
}

definition app/user {}
Expand Down
Loading