Question
· Apr 18, 2016

End-users maintaining Ensemble Data Lookup Tables

We are currently looking into a way to provide a group of end-users (i.e. non-Interface Development engineers) access to a pre-defined group of Ensemble-based Data Lookup Tables for purposes of viewing and editing. We do not want to give them access to ALL Data Lookup Tables due to security/continuity concerns.

My thinking is that a simple persistent Cache table with three columns (Role Name,  Table Name, Access-Level [like View or Edit]) with a CSP front-end could potentially provide an easy way to make this solution a reality.

I heard some discussion at the Conference last week that a code sample may already be available to give us a jump start in this direction but I have not been successful in locating one. Is anyone anywhere of such a sample or perhaps has delved into this themselves that might be willing to share a little context in how it could be accomplished? I am relatively new to Cache/Object Script/CSP development but eager to get my feet wet.

 

Thanks in advance - 

Craig

Discussion (1)2
Log in or sign up to continue

I just worked with WRC on this same issue. I was able to make copies of %ZEN.Dialog.finderDialog and EnsPortal.LookupSettings. By using these copies I was able to modify some of the methods to limit down the number of tables a end user would have access too by using a filter on the Naming convention.


Class osuwmc.DataLookup.testFinderDialog Extends %ZEN.Dialog.finderDialog
{

Method GetFinderArray(ByRef pParameters, Output pMetaData, Output pData) As %Status
{

Kill tParms

// assemble search parameters
Set tParms("sort") = ..currSortMode
Set tParms("search") = ..searchKey
Set tParms("abstract") = ..includeAbstract

if (..mode = "labLookup"){

tSC = ##class(%ZEN.FinderUtils).%GetArrayForQuery("Ens.Util.LookupTable","Enumerate",$LB("{Name}","{Name}_"".lut""","lut",""),".",,.pMetaData,.tData)
k=""
for {
k=$order(tData(k))
q:k=""
tableName = $li(tData(k),1)
if (tableName [ "LABS") {
pData($i(pData)) = tData(k)
}

}
tSC
}
else {
Quit ##class(%ZEN.FinderUtils).%GetClassListArray(.tParms,.pMetaData,.pData)
}
}


Class osuwmc.DataLookup.testLookupSettings Extends EnsPortal.LookupSettings
{

/// Handle various dialogs.
ClientMethod onPopupAction(popupName, action, value) [ Language = javascript ]
{
try {
if (action != "ok") {
return false;
}
popupName this.removePopupSuffix(popupName);
switch(popupName) {
case 'NewLookup':
if (value.substring(value.length-4).toUpperCase() != '.LUT') value += '.lut';
// note that we fall through to open the page for both NewLookup and LookupOpen
case 'LookupOpen':
var link zenLink('osuwmc.DataLookup.testLookupSettings.zen');
link += (link.indexOf('?') -1 '&' '?') 'LookupTable=' encodeURIComponent(value);
this.setModified(false);
this.gotoPage(link);
break;
case 'switchNamespace':
zenPage.changeURLNamespace(value);
break;
case 'LookupSaveAs':
if (value.substring(value.length-4).toUpperCase() == '.LUT') value value.substring(0,value.length-4);
zenPage.checkName(value);
break;
}
}
catch (ex) {
alert("Error: " ex);
}
}

/// If the new name is already in use, confirm that the user wishes to overwrite the old table of that name.
ClientMethod checkName(newName) [ Language = javascript ]
{

var duplicateName zenPage.NameCheck(newName);
if (duplicateName !="")
{
if (!confirm($$$FormatText($$$Text("Lookup table name '%1' is already in use! Are you sure you want to overwrite this table?"),duplicateName))) {
return;
}
zenPage.RemoveTable(duplicateName);
}
zenPage.renameSave(newName);
var link zenLink('osuwmc.DataLookup.testLookupSettings.zen');
link += (link.indexOf('?') -1 '&' '?') 'LookupTable=' encodeURIComponent(newName+".lut");
this.setModified(false);
this.gotoPage(link);
}

ClientMethod openTable() [ Language = javascript ]
{
if (this.pageModified) {
var doOpen confirm($$$Text('The current lookup table has been modified. Do you wish to discard these changes and open a different lookup table?'));
if (!doOpen) return;
}
var parms { MODE: "labLookup"};
zenLaunchPopupWindow(zenLink('osuwmc.DataLookup.testFinderDialog.cls'),this.addPopupSuffix('LookupOpen'),'status,scrollbars,resizable=yes,width=800,height=600',parms);
}

Method OnGetRibbonInfo(Output pDisplay As %Boolean, Output pViewIcons As %List, Output pSortOptions As %List, Output pSearchBox As %Boolean, Output pRibbonTitle As %String, Output pCommands As %List) As %Status
{
Set pDisplay = 1
Set pRibbonTitle = $$$Text("Lookup Table Viewer")
Set pCommands(1) = $LB("btnOpen",$$$Text("Open"),$$$Text("Open an existing lookup table"),"zenPage.openTable();")
Set pCommands(2) = $LB("btnSave",$$$Text("Save"),$$$Text("Save the current lookup table"),"zenPage.saveTable();")
Set pCommands(3) = $LB("btnSaveAs",$$$Text("Save As"),$$$Text("Save the current lookup table with a different name"),"zenPage.saveTableAs();")
Quit $$$OK
}

}