mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-13 17:35:12 +00:00
fix: add requests
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
)
|
||||
|
||||
func (s *Server) GetMyZitadelPermissions(ctx context.Context, _ *empty.Empty) (*MyPermissions, error) {
|
||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-or67G", "Not implemented")
|
||||
//ctxData := auth.GetCtxData(ctx)
|
||||
//
|
||||
//grants, err := s.processor.ResolveGrants(ctx, ctxData.UserID, ctxData.OrgID)
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//
|
||||
//permissions := &MyPermissions{Permissions: []string{}}
|
||||
//
|
||||
//for _, grant := range grants {
|
||||
// for _, role := range grant.Roles {
|
||||
// roleName, ctxID := auth.SplitPermission(role)
|
||||
// for _, mapping := range s.authConf.RolePermissionMappings {
|
||||
// if mapping.Role == roleName {
|
||||
// permissions.appendPermissions(ctxID, mapping.Permissions...)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//return permissions, nil
|
||||
}
|
||||
|
||||
func (p *MyPermissions) appendPermissions(ctxID string, permissions ...string) {
|
||||
for _, permission := range permissions {
|
||||
p.appendPermission(ctxID, permission)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *MyPermissions) appendPermission(ctxID, permission string) {
|
||||
if ctxID != "" {
|
||||
permission = permission + ":" + ctxID
|
||||
}
|
||||
for _, existingPermission := range p.Permissions {
|
||||
if existingPermission == permission {
|
||||
return
|
||||
}
|
||||
}
|
||||
p.Permissions = append(p.Permissions, permission)
|
||||
}
|
||||
Reference in New Issue
Block a user