Hi Community,
We are using the case section with 4 different pages based on the case types. We are required to disable the creation permission for different page types based on the user roles.
The OOTB Operation permission functionality in the object permission allows the Restriction at the object level. However, according to the requirement, we require this permission at the page level. Is there any workaround for us to achieve this?
I also tried the code attached below to achieve this requirement. But seems like I am missing something and the code is not working as expected.
initEditPages: function () {
var roleName = "System administrators";
var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
rootSchemaName: "SysUserInRole"
});
esq.addColumn("SysRole");
esq.filters.add("UserFilter", Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL, "SysUser", Terrasoft.SysValue.CURRENT_USER.value
));
esq.filters.add("RoleFilter", Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL, "SysRole.Name", roleName
));
esq.getEntityCollection(function(result) {
if (!result.success || result.collection.getItems().length === 0) {
// the user is *not* in the role
// do something here if needed
}
else {
// the user *is* in the role
var scope = this;
var Ext = this.Ext;
var Terrasoft = this.Terrasoft;
var collection = Ext.create("Terrasoft.BaseViewModelCollection");
var entityStructure = this.getEntityStructure(this.entitySchemaName);
if (entityStructure) {
Terrasoft.each(entityStructure.pages, function(editPage) {
var typeUId = editPage.UId || Terrasoft.GUID_EMPTY;
if (editPage.cardSchema === "BEACRCase2Page") {
collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
values: {
Id: typeUId,
Caption: editPage.caption,
Click: {bindTo: "addRecord"},
Tag: typeUId,
SchemaName: editPage.cardSchema
}
}));
}
else if (editPage.cardSchema === "BEACRCase1Page") {
collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
values: {
Id: typeUId,
Caption: editPage.caption,
//Click: {bindTo: "addRecord"},
Tag: typeUId,
SchemaName: editPage.cardSchema
}
}));
} else if (editPage.cardSchema === "BEACCCase1Page") {
collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
values: {
Id: typeUId,
Caption: editPage.caption,
//Click: {bindTo: "addRecord"},
Tag: typeUId,
SchemaName: editPage.cardSchema
}
}));
} else if (editPage.cardSchema === "BEAKRCase1Page") {
collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
values: {
Id: typeUId,
Caption: editPage.caption,
//Click: {bindTo: "addRecord"},
Tag: typeUId,
SchemaName: editPage.cardSchema
}
}));
}
}, scope);
}
this.set("EditPages", collection);
}
}, this);
},
Kindly assist me in resolving this issue, please.