Improve add model initialization

This commit is contained in:
Yang Luo
2023-05-05 01:48:10 +08:00
parent 69ee6a6f7e
commit 5b27f939b8
2 changed files with 30 additions and 5 deletions

View File

@ -22,6 +22,21 @@ import i18next from "i18next";
import BaseListPage from "./BaseListPage";
import PopconfirmModal from "./common/modal/PopconfirmModal";
const rbacModel = `[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act`;
class ModelListPage extends BaseListPage {
newModel() {
const randomName = Setting.getRandomName();
@ -30,7 +45,7 @@ class ModelListPage extends BaseListPage {
name: `model_${randomName}`,
createdTime: moment().format(),
displayName: `New Model - ${randomName}`,
modelText: "",
modelText: rbacModel,
isEnabled: true,
};
}