26 lines
943 B
Go
26 lines
943 B
Go
package usecase
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gateway/internal/model/permission/domain/enum"
|
|
)
|
|
|
|
// MePermissionsResponse is the shape consumed by frontend client code to
|
|
// render menu/feature switches. Status enables the legacy permission-server
|
|
// "open/close" pattern so keys can be hidden without removing rules.
|
|
type MePermissionsResponse struct {
|
|
UID string `json:"uid"`
|
|
TenantID string `json:"tenant_id"`
|
|
Roles []string `json:"roles"`
|
|
Permissions enum.Permissions `json:"permissions"`
|
|
Tree []*PermissionTreeNode `json:"tree,omitempty"`
|
|
}
|
|
|
|
// AuthorizationQueryUseCase composes Role + RolePermission + Permission +
|
|
// PermissionTree to materialise the "what can the current user see" map
|
|
// returned by GET /permissions/me.
|
|
type AuthorizationQueryUseCase interface {
|
|
Me(ctx context.Context, tenantID, uid string, includeTree bool) (*MePermissionsResponse, error)
|
|
}
|