mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17:32 +00:00
refactor: cleanup unused code (#7130)
* refactor: drop unused code * refactor: drop unused code
This commit is contained in:
@@ -14,54 +14,9 @@ type ProjectGrant struct {
|
||||
Members []*ProjectGrantMember
|
||||
}
|
||||
|
||||
type ProjectGrantIDs struct {
|
||||
ProjectID string
|
||||
GrantID string
|
||||
}
|
||||
|
||||
type ProjectGrantState int32
|
||||
|
||||
const (
|
||||
ProjectGrantStateActive ProjectGrantState = iota
|
||||
ProjectGrantStateInactive
|
||||
)
|
||||
|
||||
func NewProjectGrant(projectID, grantID string) *ProjectGrant {
|
||||
return &ProjectGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: projectID}, GrantID: grantID, State: ProjectGrantStateActive}
|
||||
}
|
||||
|
||||
func (p *ProjectGrant) IsActive() bool {
|
||||
return p.State == ProjectGrantStateActive
|
||||
}
|
||||
|
||||
func (p *ProjectGrant) IsValid() bool {
|
||||
return p.GrantedOrgID != ""
|
||||
}
|
||||
|
||||
func (p *ProjectGrant) GetMember(userID string) (int, *ProjectGrantMember) {
|
||||
for i, m := range p.Members {
|
||||
if m.UserID == userID {
|
||||
return i, m
|
||||
}
|
||||
}
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (p *ProjectGrant) GetRemovedRoles(roleKeys []string) []string {
|
||||
removed := make([]string, 0)
|
||||
for _, role := range p.RoleKeys {
|
||||
if !containsKey(roleKeys, 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