mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 19:57:22 +00:00
fix: query side (#257)
* fix: project by id return projectview * fix: return always view model on query side * fix: return always view model on query side
This commit is contained in:
parent
6556d053b2
commit
1de574df42
@ -20,12 +20,15 @@ type OrgRepository struct {
|
||||
Roles []string
|
||||
}
|
||||
|
||||
func (repo *OrgRepository) OrgByID(ctx context.Context, id string) (*org_model.Org, error) {
|
||||
org := org_model.NewOrg(id)
|
||||
return repo.OrgEventstore.OrgByID(ctx, org)
|
||||
func (repo *OrgRepository) OrgByID(ctx context.Context, id string) (*org_model.OrgView, error) {
|
||||
org, err := repo.View.OrgByID(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.OrgToModel(org), nil
|
||||
}
|
||||
|
||||
func (repo *OrgRepository) OrgByDomainGlobal(ctx context.Context, domain string) (*org_model.Org, error) {
|
||||
func (repo *OrgRepository) OrgByDomainGlobal(ctx context.Context, domain string) (*org_model.OrgView, error) {
|
||||
verifiedDomain, err := repo.View.VerifiedOrgDomain(domain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -82,9 +85,12 @@ func (repo *OrgRepository) OrgChanges(ctx context.Context, id string, lastSequen
|
||||
return changes, nil
|
||||
}
|
||||
|
||||
func (repo *OrgRepository) OrgMemberByID(ctx context.Context, orgID, userID string) (member *org_model.OrgMember, err error) {
|
||||
member = org_model.NewOrgMember(orgID, userID)
|
||||
return repo.OrgEventstore.OrgMemberByIDs(ctx, member)
|
||||
func (repo *OrgRepository) OrgMemberByID(ctx context.Context, orgID, userID string) (*org_model.OrgMemberView, error) {
|
||||
member, err := repo.View.OrgMemberByIDs(orgID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.OrgMemberToModel(member), nil
|
||||
}
|
||||
|
||||
func (repo *OrgRepository) AddMyOrgMember(ctx context.Context, member *org_model.OrgMember) (*org_model.OrgMember, error) {
|
||||
|
@ -31,8 +31,12 @@ type ProjectRepo struct {
|
||||
Roles []string
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) ProjectByID(ctx context.Context, id string) (project *proj_model.Project, err error) {
|
||||
return repo.ProjectEvents.ProjectByID(ctx, id)
|
||||
func (repo *ProjectRepo) ProjectByID(ctx context.Context, id string) (*proj_model.ProjectView, error) {
|
||||
project, err := repo.View.ProjectByID(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.ProjectToModel(project), nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) CreateProject(ctx context.Context, name string) (*proj_model.Project, error) {
|
||||
@ -81,9 +85,12 @@ func (repo *ProjectRepo) ProjectGrantViewByID(ctx context.Context, grantID strin
|
||||
return model.ProjectGrantToModel(p), nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) ProjectMemberByID(ctx context.Context, projectID, userID string) (member *proj_model.ProjectMember, err error) {
|
||||
member = proj_model.NewProjectMember(projectID, userID)
|
||||
return repo.ProjectEvents.ProjectMemberByIDs(ctx, member)
|
||||
func (repo *ProjectRepo) ProjectMemberByID(ctx context.Context, projectID, userID string) (*proj_model.ProjectMemberView, error) {
|
||||
member, err := repo.View.ProjectMemberByIDs(projectID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.ProjectMemberToModel(member), nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) AddProjectMember(ctx context.Context, member *proj_model.ProjectMember) (*proj_model.ProjectMember, error) {
|
||||
@ -185,8 +192,12 @@ func (repo *ProjectRepo) ProjectChanges(ctx context.Context, id string, lastSequ
|
||||
return changes, nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) ApplicationByID(ctx context.Context, projectID, appID string) (app *proj_model.Application, err error) {
|
||||
return repo.ProjectEvents.ApplicationByIDs(ctx, projectID, appID)
|
||||
func (repo *ProjectRepo) ApplicationByID(ctx context.Context, appID string) (*proj_model.ApplicationView, error) {
|
||||
app, err := repo.View.ApplicationByID(appID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.ApplicationViewToModel(app), nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) AddApplication(ctx context.Context, app *proj_model.Application) (*proj_model.Application, error) {
|
||||
@ -240,8 +251,12 @@ func (repo *ProjectRepo) ChangeOIDConfigSecret(ctx context.Context, projectID, a
|
||||
return repo.ProjectEvents.ChangeOIDCConfigSecret(ctx, projectID, appID)
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) ProjectGrantByID(ctx context.Context, projectID, appID string) (app *proj_model.ProjectGrant, err error) {
|
||||
return repo.ProjectEvents.ProjectGrantByIDs(ctx, projectID, appID)
|
||||
func (repo *ProjectRepo) ProjectGrantByID(ctx context.Context, grantID string) (*proj_model.ProjectGrantView, error) {
|
||||
grant, err := repo.View.ProjectGrantByID(grantID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.ProjectGrantToModel(grant), nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) SearchProjectGrants(ctx context.Context, request *proj_model.ProjectGrantViewSearchRequest) (*proj_model.ProjectGrantViewSearchResponse, error) {
|
||||
@ -354,9 +369,12 @@ func (repo *ProjectRepo) RemoveProjectGrant(ctx context.Context, projectID, gran
|
||||
return nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) ProjectGrantMemberByID(ctx context.Context, projectID, grantID, userID string) (member *proj_model.ProjectGrantMember, err error) {
|
||||
member = proj_model.NewProjectGrantMember(projectID, grantID, userID)
|
||||
return repo.ProjectEvents.ProjectGrantMemberByIDs(ctx, member)
|
||||
func (repo *ProjectRepo) ProjectGrantMemberByID(ctx context.Context, projectID, userID string) (*proj_model.ProjectGrantMemberView, error) {
|
||||
member, err := repo.View.ProjectGrantMemberByIDs(projectID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.ProjectGrantMemberToModel(member), nil
|
||||
}
|
||||
|
||||
func (repo *ProjectRepo) AddProjectGrantMember(ctx context.Context, member *proj_model.ProjectGrantMember) (*proj_model.ProjectGrantMember, error) {
|
||||
|
@ -14,8 +14,12 @@ type UserGrantRepo struct {
|
||||
View *view.View
|
||||
}
|
||||
|
||||
func (repo *UserGrantRepo) UserGrantByID(ctx context.Context, grantID string) (*grant_model.UserGrant, error) {
|
||||
return repo.UserGrantEvents.UserGrantByID(ctx, grantID)
|
||||
func (repo *UserGrantRepo) UserGrantByID(ctx context.Context, grantID string) (*grant_model.UserGrantView, error) {
|
||||
grant, err := repo.View.UserGrantByID(grantID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model.UserGrantToModel(grant), nil
|
||||
}
|
||||
|
||||
func (repo *UserGrantRepo) AddUserGrant(ctx context.Context, grant *grant_model.UserGrant) (*grant_model.UserGrant, error) {
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
)
|
||||
|
||||
type OrgRepository interface {
|
||||
OrgByID(ctx context.Context, id string) (*org_model.Org, error)
|
||||
OrgByDomainGlobal(ctx context.Context, domain string) (*org_model.Org, error)
|
||||
OrgByID(ctx context.Context, id string) (*org_model.OrgView, error)
|
||||
OrgByDomainGlobal(ctx context.Context, domain string) (*org_model.OrgView, error)
|
||||
UpdateOrg(ctx context.Context, org *org_model.Org) (*org_model.Org, error)
|
||||
DeactivateOrg(ctx context.Context, id string) (*org_model.Org, error)
|
||||
ReactivateOrg(ctx context.Context, id string) (*org_model.Org, error)
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type ProjectRepository interface {
|
||||
ProjectByID(ctx context.Context, id string) (*model.Project, error)
|
||||
ProjectByID(ctx context.Context, id string) (*model.ProjectView, error)
|
||||
CreateProject(ctx context.Context, name string) (*model.Project, error)
|
||||
UpdateProject(ctx context.Context, project *model.Project) (*model.Project, error)
|
||||
DeactivateProject(ctx context.Context, id string) (*model.Project, error)
|
||||
@ -16,7 +16,7 @@ type ProjectRepository interface {
|
||||
SearchProjectGrants(ctx context.Context, request *model.ProjectGrantViewSearchRequest) (*model.ProjectGrantViewSearchResponse, error)
|
||||
ProjectGrantViewByID(ctx context.Context, grantID string) (*model.ProjectGrantView, error)
|
||||
|
||||
ProjectMemberByID(ctx context.Context, projectID, userID string) (*model.ProjectMember, error)
|
||||
ProjectMemberByID(ctx context.Context, projectID, userID string) (*model.ProjectMemberView, error)
|
||||
AddProjectMember(ctx context.Context, member *model.ProjectMember) (*model.ProjectMember, error)
|
||||
ChangeProjectMember(ctx context.Context, member *model.ProjectMember) (*model.ProjectMember, error)
|
||||
RemoveProjectMember(ctx context.Context, projectID, userID string) error
|
||||
@ -30,7 +30,7 @@ type ProjectRepository interface {
|
||||
ProjectChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*model.ProjectChanges, error)
|
||||
BulkAddProjectRole(ctx context.Context, role []*model.ProjectRole) error
|
||||
|
||||
ApplicationByID(ctx context.Context, projectID, appID string) (*model.Application, error)
|
||||
ApplicationByID(ctx context.Context, appID string) (*model.ApplicationView, error)
|
||||
AddApplication(ctx context.Context, app *model.Application) (*model.Application, error)
|
||||
ChangeApplication(ctx context.Context, app *model.Application) (*model.Application, error)
|
||||
DeactivateApplication(ctx context.Context, projectID, appID string) (*model.Application, error)
|
||||
@ -41,7 +41,7 @@ type ProjectRepository interface {
|
||||
SearchApplications(ctx context.Context, request *model.ApplicationSearchRequest) (*model.ApplicationSearchResponse, error)
|
||||
ApplicationChanges(ctx context.Context, id string, secId string, lastSequence uint64, limit uint64) (*model.ApplicationChanges, error)
|
||||
|
||||
ProjectGrantByID(ctx context.Context, projectID, grantID string) (*model.ProjectGrant, error)
|
||||
ProjectGrantByID(ctx context.Context, grantID string) (*model.ProjectGrantView, error)
|
||||
AddProjectGrant(ctx context.Context, grant *model.ProjectGrant) (*model.ProjectGrant, error)
|
||||
ChangeProjectGrant(ctx context.Context, grant *model.ProjectGrant) (*model.ProjectGrant, error)
|
||||
DeactivateProjectGrant(ctx context.Context, projectID, grantID string) (*model.ProjectGrant, error)
|
||||
@ -49,7 +49,7 @@ type ProjectRepository interface {
|
||||
RemoveProjectGrant(ctx context.Context, projectID, grantID string) error
|
||||
SearchProjectGrantMembers(ctx context.Context, request *model.ProjectGrantMemberSearchRequest) (*model.ProjectGrantMemberSearchResponse, error)
|
||||
|
||||
ProjectGrantMemberByID(ctx context.Context, projectID, grantID, userID string) (*model.ProjectGrantMember, error)
|
||||
ProjectGrantMemberByID(ctx context.Context, projectID, userID string) (*model.ProjectGrantMemberView, error)
|
||||
AddProjectGrantMember(ctx context.Context, member *model.ProjectGrantMember) (*model.ProjectGrantMember, error)
|
||||
ChangeProjectGrantMember(ctx context.Context, member *model.ProjectGrantMember) (*model.ProjectGrantMember, error)
|
||||
RemoveProjectGrantMember(ctx context.Context, projectID, grantID, userID string) error
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type UserGrantRepository interface {
|
||||
UserGrantByID(ctx context.Context, grantID string) (*model.UserGrant, error)
|
||||
UserGrantByID(ctx context.Context, grantID string) (*model.UserGrantView, error)
|
||||
AddUserGrant(ctx context.Context, grant *model.UserGrant) (*model.UserGrant, error)
|
||||
ChangeUserGrant(ctx context.Context, grant *model.UserGrant) (*model.UserGrant, error)
|
||||
DeactivateUserGrant(ctx context.Context, grantID string) (*model.UserGrant, error)
|
||||
|
@ -14,12 +14,12 @@ func (s *Server) SearchApplications(ctx context.Context, in *ApplicationSearchRe
|
||||
return applicationSearchResponseFromModel(response), nil
|
||||
}
|
||||
|
||||
func (s *Server) ApplicationByID(ctx context.Context, in *ApplicationID) (*Application, error) {
|
||||
app, err := s.project.ApplicationByID(ctx, in.ProjectId, in.Id)
|
||||
func (s *Server) ApplicationByID(ctx context.Context, in *ApplicationID) (*ApplicationView, error) {
|
||||
app, err := s.project.ApplicationByID(ctx, in.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return appFromModel(app), nil
|
||||
return applicationViewFromModel(app), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateOIDCApplication(ctx context.Context, in *OIDCApplicationCreate) (*Application, error) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1Org"
|
||||
"$ref": "#/definitions/v1OrgView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -450,7 +450,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1Org"
|
||||
"$ref": "#/definitions/v1OrgView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -914,7 +914,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1UserGrant"
|
||||
"$ref": "#/definitions/v1UserGrantView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1167,7 +1167,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1Project"
|
||||
"$ref": "#/definitions/v1ProjectView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1673,7 +1673,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1Application"
|
||||
"$ref": "#/definitions/v1ApplicationView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2100,7 +2100,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1ProjectGrant"
|
||||
"$ref": "#/definitions/v1ProjectGrantView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2438,7 +2438,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1UserGrant"
|
||||
"$ref": "#/definitions/v1UserGrantView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3405,7 +3405,7 @@
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1UserGrant"
|
||||
"$ref": "#/definitions/v1UserGrantView"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -4656,6 +4656,32 @@
|
||||
],
|
||||
"default": "ORGSTATE_UNSPECIFIED"
|
||||
},
|
||||
"v1OrgView": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/v1OrgState"
|
||||
},
|
||||
"creation_date": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"change_date": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"sequence": {
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1PasswordAgePolicy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -5,20 +5,20 @@ import (
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
)
|
||||
|
||||
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (*Org, error) {
|
||||
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (*OrgView, error) {
|
||||
org, err := s.org.OrgByID(ctx, orgID.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgFromModel(org), nil
|
||||
return orgViewFromModel(org), nil
|
||||
}
|
||||
|
||||
func (s *Server) GetOrgByDomainGlobal(ctx context.Context, in *OrgDomain) (*Org, error) {
|
||||
func (s *Server) GetOrgByDomainGlobal(ctx context.Context, in *OrgDomain) (*OrgView, error) {
|
||||
org, err := s.org.OrgByDomainGlobal(ctx, in.Domain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgFromModel(org), nil
|
||||
return orgViewFromModel(org), nil
|
||||
}
|
||||
|
||||
func (s *Server) DeactivateOrg(ctx context.Context, in *OrgID) (*Org, error) {
|
||||
|
@ -34,14 +34,14 @@ func orgFromModel(org *org_model.Org) *Org {
|
||||
}
|
||||
}
|
||||
|
||||
func orgFromView(org *org_model.OrgView) *Org {
|
||||
func orgViewFromModel(org *org_model.OrgView) *OrgView {
|
||||
creationDate, err := ptypes.TimestampProto(org.CreationDate)
|
||||
logging.Log("GRPC-GTHsZ").OnError(err).Debug("unable to get timestamp from time")
|
||||
|
||||
changeDate, err := ptypes.TimestampProto(org.ChangeDate)
|
||||
logging.Log("GRPC-dVnoj").OnError(err).Debug("unable to get timestamp from time")
|
||||
|
||||
return &Org{
|
||||
return &OrgView{
|
||||
ChangeDate: changeDate,
|
||||
CreationDate: creationDate,
|
||||
Id: org.ID,
|
||||
|
@ -48,12 +48,12 @@ func (s *Server) SearchProjects(ctx context.Context, in *ProjectSearchRequest) (
|
||||
return projectSearchResponseFromModel(response), nil
|
||||
}
|
||||
|
||||
func (s *Server) ProjectByID(ctx context.Context, id *ProjectID) (*Project, error) {
|
||||
func (s *Server) ProjectByID(ctx context.Context, id *ProjectID) (*ProjectView, error) {
|
||||
project, err := s.project.ProjectByID(ctx, id.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return projectFromModel(project), nil
|
||||
return projectViewFromModel(project), nil
|
||||
}
|
||||
|
||||
func (s *Server) SearchGrantedProjects(ctx context.Context, in *GrantedProjectSearchRequest) (*ProjectGrantSearchResponse, error) {
|
||||
|
@ -20,12 +20,12 @@ func (s *Server) SearchProjectGrants(ctx context.Context, in *ProjectGrantSearch
|
||||
return projectGrantSearchResponseFromModel(response), nil
|
||||
}
|
||||
|
||||
func (s *Server) ProjectGrantByID(ctx context.Context, in *ProjectGrantID) (*ProjectGrant, error) {
|
||||
grant, err := s.project.ProjectGrantByID(ctx, in.ProjectId, in.Id)
|
||||
func (s *Server) ProjectGrantByID(ctx context.Context, in *ProjectGrantID) (*ProjectGrantView, error) {
|
||||
grant, err := s.project.ProjectGrantByID(ctx, in.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return projectGrantFromModel(grant), nil
|
||||
return projectGrantFromGrantedProjectModel(grant), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateProjectGrant(ctx context.Context, in *ProjectGrantCreate) (*ProjectGrant, error) {
|
||||
|
@ -17,12 +17,12 @@ func (s *Server) SearchUserGrants(ctx context.Context, in *UserGrantSearchReques
|
||||
return userGrantSearchResponseFromModel(response), nil
|
||||
}
|
||||
|
||||
func (s *Server) UserGrantByID(ctx context.Context, request *UserGrantID) (*UserGrant, error) {
|
||||
func (s *Server) UserGrantByID(ctx context.Context, request *UserGrantID) (*UserGrantView, error) {
|
||||
user, err := s.usergrant.UserGrantByID(ctx, request.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return usergrantFromModel(user), nil
|
||||
return userGrantViewFromModel(user), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateUserGrant(ctx context.Context, in *UserGrantCreate) (*UserGrant, error) {
|
||||
@ -79,12 +79,12 @@ func (s *Server) SearchProjectUserGrants(ctx context.Context, request *ProjectUs
|
||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-8jdSw", "Not implemented")
|
||||
}
|
||||
|
||||
func (s *Server) ProjectUserGrantByID(ctx context.Context, request *ProjectUserGrantID) (*UserGrant, error) {
|
||||
func (s *Server) ProjectUserGrantByID(ctx context.Context, request *ProjectUserGrantID) (*UserGrantView, error) {
|
||||
user, err := s.usergrant.UserGrantByID(ctx, request.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return usergrantFromModel(user), nil
|
||||
return userGrantViewFromModel(user), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateProjectUserGrant(ctx context.Context, in *UserGrantCreate) (*UserGrant, error) {
|
||||
@ -122,12 +122,12 @@ func (s *Server) SearchProjectGrantUserGrants(ctx context.Context, request *Proj
|
||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-32sFs", "Not implemented")
|
||||
}
|
||||
|
||||
func (s *Server) ProjectGrantUserGrantByID(ctx context.Context, request *ProjectGrantUserGrantID) (*UserGrant, error) {
|
||||
func (s *Server) ProjectGrantUserGrantByID(ctx context.Context, request *ProjectGrantUserGrantID) (*UserGrantView, error) {
|
||||
user, err := s.usergrant.UserGrantByID(ctx, request.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return usergrantFromModel(user), nil
|
||||
return userGrantViewFromModel(user), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateProjectGrantUserGrant(ctx context.Context, in *ProjectGrantUserGrantCreate) (*UserGrant, error) {
|
||||
|
@ -485,7 +485,7 @@ service ManagementService {
|
||||
}
|
||||
|
||||
//ORG
|
||||
rpc GetOrgByID(OrgID) returns (Org) {
|
||||
rpc GetOrgByID(OrgID) returns (OrgView) {
|
||||
option (google.api.http) = {
|
||||
get: "/orgs/{id}"
|
||||
};
|
||||
@ -495,7 +495,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetOrgByDomainGlobal(OrgDomain) returns (Org) {
|
||||
rpc GetOrgByDomainGlobal(OrgDomain) returns (OrgView) {
|
||||
option (google.api.http) = {
|
||||
get: "/global/orgs/domain/{domain}"
|
||||
};
|
||||
@ -527,7 +527,6 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
rpc SearchMyOrgDomains(OrgDomainSearchRequest) returns (OrgDomainSearchResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/orgs/me/domains/_search"
|
||||
@ -637,7 +636,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc ProjectByID(ProjectID) returns (Project) {
|
||||
rpc ProjectByID(ProjectID) returns (ProjectView) {
|
||||
option (google.api.http) = {
|
||||
get: "/projects/{id}"
|
||||
};
|
||||
@ -850,7 +849,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc ApplicationByID(ApplicationID) returns (Application) {
|
||||
rpc ApplicationByID(ApplicationID) returns (ApplicationView) {
|
||||
option (google.api.http) = {
|
||||
get: "/projects/{project_id}/applications/{id}"
|
||||
};
|
||||
@ -957,7 +956,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc ProjectGrantByID(ProjectGrantID) returns (ProjectGrant) {
|
||||
rpc ProjectGrantByID(ProjectGrantID) returns (ProjectGrantView) {
|
||||
option (google.api.http) = {
|
||||
get: "/projects/{project_id}/grants/{id}"
|
||||
};
|
||||
@ -1086,7 +1085,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc UserGrantByID(UserGrantID) returns (UserGrant) {
|
||||
rpc UserGrantByID(UserGrantID) returns (UserGrantView) {
|
||||
option (google.api.http) = {
|
||||
get: "/users/{user_id}/grants/{id}"
|
||||
};
|
||||
@ -1196,7 +1195,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc ProjectUserGrantByID(ProjectUserGrantID) returns (UserGrant) {
|
||||
rpc ProjectUserGrantByID(ProjectUserGrantID) returns (UserGrantView) {
|
||||
option (google.api.http) = {
|
||||
get: "/projects/{project_id}/users/{user_id}/grants/{id}"
|
||||
};
|
||||
@ -1267,7 +1266,7 @@ service ManagementService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc ProjectGrantUserGrantByID(ProjectGrantUserGrantID) returns (UserGrant) {
|
||||
rpc ProjectGrantUserGrantByID(ProjectGrantUserGrantID) returns (UserGrantView) {
|
||||
option (google.api.http) = {
|
||||
get: "/projectgrants/{project_grant_id}/users/{user_id}/grants/{id}"
|
||||
};
|
||||
@ -1812,6 +1811,15 @@ message Org {
|
||||
uint64 sequence = 6;
|
||||
}
|
||||
|
||||
message OrgView {
|
||||
string id = 1;
|
||||
OrgState state = 2;
|
||||
google.protobuf.Timestamp creation_date = 3;
|
||||
google.protobuf.Timestamp change_date = 4;
|
||||
string name = 5;
|
||||
uint64 sequence = 6;
|
||||
}
|
||||
|
||||
enum OrgState {
|
||||
ORGSTATE_UNSPECIFIED = 0;
|
||||
ORGSTATE_ACTIVE = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user