mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:37:31 +00:00
fix: move v2 pkgs (#1331)
* fix: move eventstore pkgs * fix: move eventstore pkgs * fix: remove v2 view * fix: remove v2 view
This commit is contained in:
49
internal/domain/project_grant.go
Normal file
49
internal/domain/project_grant.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package domain
|
||||
|
||||
import es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
|
||||
type ProjectGrant struct {
|
||||
es_models.ObjectRoot
|
||||
|
||||
GrantID string
|
||||
GrantedOrgID string
|
||||
State ProjectGrantState
|
||||
RoleKeys []string
|
||||
}
|
||||
|
||||
type ProjectGrantIDs struct {
|
||||
ProjectID string
|
||||
GrantID string
|
||||
}
|
||||
|
||||
type ProjectGrantState int32
|
||||
|
||||
const (
|
||||
ProjectGrantStateUnspecified ProjectGrantState = iota
|
||||
ProjectGrantStateActive
|
||||
ProjectGrantStateInactive
|
||||
ProjectGrantStateRemoved
|
||||
)
|
||||
|
||||
func (p *ProjectGrant) IsValid() bool {
|
||||
return p.GrantedOrgID != ""
|
||||
}
|
||||
|
||||
func GetRemovedRoles(existingRoles, newRoles []string) []string {
|
||||
removed := make([]string, 0)
|
||||
for _, role := range existingRoles {
|
||||
if !containsKey(newRoles, role) {
|
||||
removed = append(removed, role)
|
||||
}
|
||||
}
|
||||
return removed
|
||||
}
|
||||
|
||||
func containsKey(roles []string, key string) bool {
|
||||
for _, role := range roles {
|
||||
if role == key {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user