mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 23:18:54 +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:
@@ -26,6 +26,14 @@ func usergrantFromModel(grant *grant_model.UserGrant) *UserGrant {
|
||||
}
|
||||
}
|
||||
|
||||
func userGrantCreateBulkToModel(u *UserGrantCreateBulk) []*grant_model.UserGrant {
|
||||
grants := make([]*grant_model.UserGrant, len(u.UserGrants))
|
||||
for i, grant := range u.UserGrants {
|
||||
grants[i] = userGrantCreateToModel(grant)
|
||||
}
|
||||
return grants
|
||||
}
|
||||
|
||||
func userGrantCreateToModel(u *UserGrantCreate) *grant_model.UserGrant {
|
||||
return &grant_model.UserGrant{
|
||||
ObjectRoot: models.ObjectRoot{AggregateID: u.UserId},
|
||||
@@ -35,6 +43,14 @@ func userGrantCreateToModel(u *UserGrantCreate) *grant_model.UserGrant {
|
||||
}
|
||||
}
|
||||
|
||||
func userGrantUpdateBulkToModel(u *UserGrantUpdateBulk) []*grant_model.UserGrant {
|
||||
grants := make([]*grant_model.UserGrant, len(u.UserGrants))
|
||||
for i, grant := range u.UserGrants {
|
||||
grants[i] = userGrantUpdateToModel(grant)
|
||||
}
|
||||
return grants
|
||||
}
|
||||
|
||||
func userGrantUpdateToModel(u *UserGrantUpdate) *grant_model.UserGrant {
|
||||
return &grant_model.UserGrant{
|
||||
ObjectRoot: models.ObjectRoot{AggregateID: u.Id},
|
||||
@@ -42,6 +58,14 @@ func userGrantUpdateToModel(u *UserGrantUpdate) *grant_model.UserGrant {
|
||||
}
|
||||
}
|
||||
|
||||
func userGrantRemoveBulkToModel(u *UserGrantRemoveBulk) []string {
|
||||
ids := make([]string, len(u.Ids))
|
||||
for i, id := range u.Ids {
|
||||
ids[i] = id
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
func projectUserGrantUpdateToModel(u *ProjectUserGrantUpdate) *grant_model.UserGrant {
|
||||
return &grant_model.UserGrant{
|
||||
ObjectRoot: models.ObjectRoot{AggregateID: u.Id},
|
||||
@@ -96,6 +120,8 @@ func userGrantSearchKeyToModel(key UserGrantSearchKey) grant_model.UserGrantSear
|
||||
return grant_model.USERGRANTSEARCHKEY_PROJECT_ID
|
||||
case UserGrantSearchKey_USERGRANTSEARCHKEY_USER_ID:
|
||||
return grant_model.USERGRANTSEARCHKEY_USER_ID
|
||||
case UserGrantSearchKey_USERGRANTSEARCHKEY_ROLE_KEY:
|
||||
return grant_model.USERGRANTSEARCHKEY_ROLE_KEY
|
||||
default:
|
||||
return grant_model.USERGRANTSEARCHKEY_UNSPECIFIED
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user