mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix editing of kube resource (#5906)
This commit is contained in:
1 parent
b94672b5a8
commit
e682c7de45
59 files changed
+14123
-298
No files matched your search
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { KubeResource } from "../rbac";
|
||||
import { apiResourceRecord, apiResources } from "../rbac";
|
||||
|
||||
export const isAllowedResource = (allowedResources: string[]) => (kind: string): boolean => {
|
||||
if ((kind as KubeResource) in apiResourceRecord) {
|
||||
return allowedResources.includes(kind);
|
||||
}
|
||||
|
||||
const apiResource = apiResources.find(resource => resource.kind === kind);
|
||||
|
||||
if (apiResource) {
|
||||
return allowedResources.includes(apiResource.apiName);
|
||||
}
|
||||
|
||||
return true; // allowed by default for other resources
|
||||
};
|
||||
Reference in new issue
Block a user