chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)
This commit is contained in:
commit
9097ee699d
5769 files changed
+1446466
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package access
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
)
|
||||
|
||||
// IsCrossTenantSuperuser reports whether the caller's user attribute and the
|
||||
// cluster-wide flag both allow bypassing workspace role gates. API-key and
|
||||
// resource-scope authorization remain separate checks.
|
||||
func IsCrossTenantSuperuser(ctx context.Context, cfg *config.Config) bool {
|
||||
if cfg == nil || cfg.Tenant == nil || !cfg.Tenant.EnableCrossTenantAccess {
|
||||
return false
|
||||
}
|
||||
u, ok := ctx.Value(types.UserContextKey).(*types.User)
|
||||
return ok && u != nil && u.CanAccessAllTenants
|
||||
}
|
||||
Reference in new issue
Block a user