mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-23 11:23:36 +00:00
feat: delete (#243)
* 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
This commit is contained in:
@@ -30,3 +30,26 @@ func (u *UserGrant) IsActive() bool {
|
||||
func (u *UserGrant) IsInactive() bool {
|
||||
return u.State == USERGRANTSTATE_INACTIVE
|
||||
}
|
||||
|
||||
func (u *UserGrant) RemoveRoleKeyIfExisting(key string) bool {
|
||||
for i, role := range u.RoleKeys {
|
||||
if role == key {
|
||||
u.RoleKeys[i] = u.RoleKeys[len(u.RoleKeys)-1]
|
||||
u.RoleKeys[len(u.RoleKeys)-1] = ""
|
||||
u.RoleKeys = u.RoleKeys[:len(u.RoleKeys)-1]
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (u *UserGrant) RemoveRoleKeysIfExisting(keys []string) bool {
|
||||
exists := false
|
||||
for _, key := range keys {
|
||||
keyExists := u.RemoveRoleKeyIfExisting(key)
|
||||
if keyExists {
|
||||
exists = true
|
||||
}
|
||||
}
|
||||
return exists
|
||||
}
|
||||
|
@@ -44,12 +44,13 @@ const (
|
||||
USERGRANTSEARCHKEY_STATE
|
||||
USERGRANTSEARCHKEY_GRANT_ID
|
||||
USERGRANTSEARCHKEY_ORG_NAME
|
||||
USERGRANTSEARCHKEY_ROLE_KEY
|
||||
)
|
||||
|
||||
type UserGrantSearchQuery struct {
|
||||
Key UserGrantSearchKey
|
||||
Method model.SearchMethod
|
||||
Value string
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
type UserGrantSearchResponse struct {
|
||||
|
Reference in New Issue
Block a user