mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
710652ef24
* feat: project role remove * feat: search queries * feat: search queries * feat: cascade remove/change project role * fix: comment in project grant * fix: remove projecr grant * fix: only search usergrants of my org * fix: delete usergrants * fix: delete usergrants * fix: check if role exists on project grant * feat: bulk add project role * fix: tests * fix: update user grants on project update * fix: return roles * feat: add resourceowner name on project grants * fix: migration number * fix: tests * fix: generate protos * fix: some unnecessary code
74 lines
2.0 KiB
Go
74 lines
2.0 KiB
Go
package model
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/model"
|
|
"time"
|
|
)
|
|
|
|
type ProjectGrantView struct {
|
|
ProjectID string
|
|
Name string
|
|
CreationDate time.Time
|
|
ChangeDate time.Time
|
|
State ProjectState
|
|
ResourceOwner string
|
|
ResourceOwnerName string
|
|
OrgID string
|
|
OrgName string
|
|
OrgDomain string
|
|
Sequence uint64
|
|
GrantID string
|
|
GrantedRoleKeys []string
|
|
}
|
|
|
|
type ProjectGrantViewSearchRequest struct {
|
|
Offset uint64
|
|
Limit uint64
|
|
SortingColumn ProjectGrantViewSearchKey
|
|
Asc bool
|
|
Queries []*ProjectGrantViewSearchQuery
|
|
}
|
|
|
|
type ProjectGrantViewSearchKey int32
|
|
|
|
const (
|
|
GRANTEDPROJECTSEARCHKEY_UNSPECIFIED ProjectGrantViewSearchKey = iota
|
|
GRANTEDPROJECTSEARCHKEY_NAME
|
|
GRANTEDPROJECTSEARCHKEY_PROJECTID
|
|
GRANTEDPROJECTSEARCHKEY_GRANTID
|
|
GRANTEDPROJECTSEARCHKEY_ORGID
|
|
GRANTEDPROJECTSEARCHKEY_RESOURCE_OWNER
|
|
GRANTEDPROJECTSEARCHKEY_ROLE_KEYS
|
|
)
|
|
|
|
type ProjectGrantViewSearchQuery struct {
|
|
Key ProjectGrantViewSearchKey
|
|
Method model.SearchMethod
|
|
Value interface{}
|
|
}
|
|
|
|
type ProjectGrantViewSearchResponse struct {
|
|
Offset uint64
|
|
Limit uint64
|
|
TotalResult uint64
|
|
Result []*ProjectGrantView
|
|
}
|
|
|
|
func (r *ProjectGrantViewSearchRequest) AppendMyOrgQuery(orgID string) {
|
|
r.Queries = append(r.Queries, &ProjectGrantViewSearchQuery{Key: GRANTEDPROJECTSEARCHKEY_ORGID, Method: model.SEARCHMETHOD_EQUALS, Value: orgID})
|
|
}
|
|
|
|
func (r *ProjectGrantViewSearchRequest) AppendNotMyOrgQuery(orgID string) {
|
|
r.Queries = append(r.Queries, &ProjectGrantViewSearchQuery{Key: GRANTEDPROJECTSEARCHKEY_ORGID, Method: model.SEARCHMETHOD_NOT_EQUALS, Value: orgID})
|
|
}
|
|
|
|
func (r *ProjectGrantViewSearchRequest) AppendMyResourceOwnerQuery(orgID string) {
|
|
r.Queries = append(r.Queries, &ProjectGrantViewSearchQuery{Key: GRANTEDPROJECTSEARCHKEY_RESOURCE_OWNER, Method: model.SEARCHMETHOD_EQUALS, Value: orgID})
|
|
}
|
|
|
|
func (r *ProjectGrantViewSearchRequest) EnsureLimit(limit uint64) {
|
|
if r.Limit == 0 || r.Limit > limit {
|
|
r.Limit = limit
|
|
}
|
|
}
|