FSN#35817 Autorisaties via API2/Scaffolding mutli edit

svn path=/Website/trunk/; revision=28692
This commit is contained in:
Jos Groot Lipman
2016-03-30 15:53:31 +00:00
parent e6f4437d83
commit 175ebc3dc7
10 changed files with 94 additions and 57 deletions

View File

@@ -602,8 +602,13 @@ api2 = {
orderbys.push(inc.model.aliasprefix + inc.model.primary);
// simpel op joinfield
var outer = "(+)";
if ("outertoggle" in inc && params.filter.scf_outer != "on")
if ("outertoggle" in inc)
{
if (params.filter.has_scf_outer && params.filter.scf_outer != "on")
outer = "";
else
outer = inc.outertoggle.def?"(+)":"";
}
wheres.push ( model.table + "." + model.primary + "=" + inc.model.table + "." + inc.model.fields[inc.joinfield].dbs + outer);
}
}

View File

@@ -73,6 +73,14 @@ function model_fac_functie (functie_key, params)
"LOV": "0;Globaal;1;Per discipline",
"hidden_fld": true
},
"group": {
"dbs": "fac_functie_groep",
"label": L("fac_functie_groep"),
"readonly": true,
"typ": "number",
"LOV": "0;Personal;1;Professional;2;Application management;null;Other",
"hidden_fld": true
},
"nn_discipline": {
"dbs": "nn_discipline",
//"label": L("fac_functie_omschrijving"),
@@ -100,7 +108,7 @@ function model_fac_functie (functie_key, params)
this.includes = {"authorization":
{ "model": new model_fac_groeprechten(params),
"joinfield": "fac_functie",
"outertoggle": { def: false, lbl: "Toon alle functies" }
"outertoggle": { def: true, lbl: L("fac_gebruiker_outerfunctie") }
}};
}

View File

@@ -63,7 +63,7 @@ function model_fac_groep(groep_key, params)
= {
"model": new model_fac_groeprechten(params),
"joinfield": "fac_groep",
outertoggle: { def: false, lbl: "Toon alle groepen" }
outertoggle: { def: true, lbl: L("fac_gebruiker_outergroep") }
};
}

View File

@@ -129,7 +129,7 @@ function model_ins_tab_discipline(disc_key, params)
this.includes = {"authorization":
{ "model": new model_fac_groeprechten(params),
"joinfield": "ins_discipline",
"outertoggle": { def: false, lbl: "Toon alle vakgroepen/catalogi" }
"outertoggle": { def: true, lbl: L("fac_gebruiker_outerdisc") }
}};
}

View File

@@ -30,7 +30,7 @@ var oRs = Oracle.Execute(sql);
var flevel = oRs("fac_functie_min_level").Value;
var fdisc = oRs("fac_functie_discipline").Value;
if (fdisc)
var disc_key = getQParamInt("ins_discipline");
var disc_arr_key = getQParamIntArray("ins_discipline");
var fdesc = oRs("fac_functie_omschrijving").Value;
var finfo = oRs("fac_functie_info").Value;
oRs.Close();
@@ -54,12 +54,10 @@ var sql = "SELECT *"
+ " WHERE fac_groep_key = " + groep_key
+ " AND fac_functie_key = " + functie_key;
if (fdisc)
sql += " AND ins_discipline_key = " + disc_key;
sql += " AND ins_discipline_key = " + disc_arr_key[0];
var oRs = Oracle.Execute(sql);
var gr_key = -1;
if (!oRs.Eof)
{
var grkey = oRs("fac_groeprechten_key").Value;
var prsread = oRs("fac_gebruiker_prs_level_read").Value;
var prswrite = oRs("fac_gebruiker_prs_level_write").Value;
var algread = oRs("fac_gebruiker_alg_level_read").Value;
@@ -185,17 +183,20 @@ function radioTD(name, LOV, val)
</script>
</head>
<body class="modal" id="mod_grprecht">
<form name="u2" action="fac_edit_groeprechten_save.asp?gr_key=<%=grkey%><%=transitParam%>" method="post">
<input type='hidden' name='fac_groeprechten_key' value='<%=gr_key%>'>
<form name="u2" action="fac_edit_groeprechten_save.asp?x=x<%=transitParam%>" method="post">
<% BLOCK_START("grpRechten", L("lcl_auth_header"));
ROFIELDTR("fldtxt", L("fac_groep"), gdesc);
ROFIELDTR("fldtxt", L("fac_groep_opmerking"), gremark, { suppressEmpty: true} );
ROFIELDTR("fldtxt", L("fac_functie"), fdesc);
ROFIELDTR("fldtxt", L("fac_functie_info"), finfo);
if (disc_key > 0)
ROFIELDTR("fldtxt", L("ins_discipline_key"), Oracle.Get("ins_discipline_omschrijving", "ins_tab_discipline", "ins_discipline_key", disc_key));
if (fdisc)
{
if (disc_arr_key.length == 1)
ROFIELDTR("fldtxt", L("ins_discipline_key"), Oracle.Get("ins_discipline_omschrijving", "ins_tab_discipline", "ins_discipline_key", disc_arr_key[0]));
else
ROFIELDTR("fldtxt", L("ins_discipline_key"), "(" + disc_arr_key.length + ")");
}
var prsLOV = api2.splitLOV(buildPrsLevelLOV());
var algLOV = api2.splitLOV(buildAlgLevelLOV());
var jnLOV = { "-1": L("lcl_Yes"), "9": L("lcl_No") };
@@ -239,7 +240,10 @@ function radioTD(name, LOV, val)
}
else
{
if (flevel == 15)
Response.Write("<tr><td colspan='2'><table><tr>");
else
Response.Write("<tr><td></td><td><table><tr>");
if (!(flevel & (4 | 8))) // niet gescoped
{
if (flevel & 2) // Schrijfrechten

View File

@@ -24,8 +24,7 @@ user.checkAutorisation("WEB_PRSSYS"); // TODO Minder scherp
var groep_key = getQParamInt("fac_groep");
var functie_key = getQParamInt("fac_functie");
var disc_key = getQParamInt("ins_discipline", -1);
var gr_key = getQParamInt("gr_key", -1);
var disc_arr_key = getQParamIntArray("ins_discipline", []);
var simple_mode = getFParamInt("simple_mode", 0) == 1;
if (simple_mode)
@@ -67,16 +66,37 @@ else // Bij alleen Ja/Nee vullen we PRS in
algread = prsread;
algwrite = prswrite;
}
if (algread == 9 || prsread == 9) // Geen rechten (over)
var fdisc = disc_arr_key.length >= 1; // Blijkbaar met disciplines
if (!fdisc)
disc_arr_key = [-1];
for (var i = 0; i < disc_arr_key.length; i++)
{
var disc_key = disc_arr_key[i];
var sql = "SELECT *"
+ " FROM fac_groeprechten"
+ " WHERE fac_groep_key = " + groep_key
+ " AND fac_functie_key = " + functie_key;
if (fdisc)
sql += " AND ins_discipline_key = " + disc_key;
var oRs = Oracle.Execute(sql);
var gr_key = -1;
if (!oRs.Eof)
{
gr_key = oRs("fac_groeprechten_key").Value;
}
oRs.Close();
if (algread == 9 || prsread == 9) // Geen rechten (over)
{
if (gr_key > 0)
{
var sql = "DELETE FROM fac_groeprechten WHERE fac_groeprechten_key = " + gr_key;
Oracle.Execute(sql);
}
}
else
{
}
else
{
var fields = [ { dbs: "fac_gebruiker_prs_level_read", typ: "number", val: prsread },
{ dbs: "fac_gebruiker_prs_level_write", typ: "number", val: prswrite },
{ dbs: "fac_gebruiker_alg_level_read", typ: "number", val: algread },
@@ -97,6 +117,7 @@ else
var grpIns = buildInsert("fac_groeprechten", fields);
Oracle.Execute(grpIns.sql);
}
}
}
var result = {success: true };

View File

@@ -21,7 +21,7 @@
var scf_params =
{
"search": {
"autosearch": true,
"autosearch": !!model.module,
"labels" : [],
"filters": [
"module"

View File

@@ -23,15 +23,6 @@
var functie_key = getQParamInt("fac_functie", -1);
var model = new model_ins_tab_discipline(null, { groep_key: groep_key, functie_key: functie_key });
function fnrowData(oRs)
{
var data = { functie_key: functie_key,
groep_key: groep_key,
module: oRs.Fields("module").Value
};
return JSON.stringify(data);
}
var scf_params =
{
"search": {
@@ -50,10 +41,10 @@
"name"
],
"default_action": "edit_rechten",
"fnRowData": fnrowData,
"requires": {
js: ["./ins_tab_discipline.js"]
}
},
"script": "window.groep_key = " + groep_key + "; window.functie_key = " + functie_key
},
"transit": {
"fac_groep": groep_key,
@@ -100,6 +91,10 @@
if (model.level & 2) // Schrijfrechten
scf_params.list.columns.push("authorization.alg_level_write");
}
scf_params.list["actions"]
= [
{ action: "edit_rechten", caption: L("fac_groeprechten_m"), multi: true, multiOnce: true, single: false }
]
}
scaffolding(model, scf_params);

View File

@@ -5,17 +5,20 @@
function edit_rechten(row)
{
debugger;
if (row instanceof Array)
var discKeyString = getKeyString(row);
else
var disc_key = row.getAttribute("ROWKEY");
var grpData = eval("(" + row.getAttribute("ROWDATA") + ")");
if (grpData.functie_key > 0 && grpData.groep_key)
if (window.functie_key > 0 && window.groep_key)
{
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}&ins_discipline={2}".format(grpData.groep_key, grpData.functie_key, disc_key);
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}&ins_discipline={2}".format(window.groep_key, window.functie_key, discKeyString||disc_key);
FcltMgr.openModalDetail(url, L("fac_groeprechten"), { callback: FcltCallbackRefresh });
}
else if (grpData.functie_key > 0)
else if (window.functie_key > 0)
{
var url = "appl/mgt/ins_tab_discipline.asp?mode=list&fac_groep=" + grpData.groep_key + "&fac_functie=" + grpData.functie_key;
var url = "appl/mgt/ins_tab_discipline.asp?mode=list&fac_groep=" + window.groep_key + "&fac_functie=" + window.functie_key;
FcltMgr.openDetail(url, { reuse: true });
}
else // eerst nog een functie erbij kiezen

View File

@@ -119,6 +119,7 @@ function scaffolding_list(model, scf_params)
alert(rows);
}
}).disableSelection() });;
<%= scf_params.list.script %>
</script>
</head>
<body id="listbody">