FSN#35817 Autorisaties via API2/Scaffolding

svn path=/Website/trunk/; revision=28651
This commit is contained in:
Jos Groot Lipman
2016-03-27 19:25:16 +00:00
parent 06450625e2
commit e2de1404b9
14 changed files with 366 additions and 213 deletions

View File

@@ -22,12 +22,12 @@ function model_fac_functie (functie_key, params)
this.primary = "fac_functie_key";
this.records_name = "fac_functies";
this.record_name = "fac_functie";
var module = null;
this.module = null;
if (params.disc_key > 0)
{
var sql = "SELECT ins_discipline_module FROM ins_tab_discipline WHERE ins_discipline_key = " + params.disc_key;
var oRs = Oracle.Execute(sql);
var module = oRs("ins_discipline_module").Value;
this.module = oRs("ins_discipline_module").Value;
oRs.Close();
}
this.fields = {
@@ -44,7 +44,7 @@ function model_fac_functie (functie_key, params)
"label": L("fac_functie_module"),
"readonly": true,
"typ": "varchar",
"filterdefault": module?":!"+module:null,
"filterdefault": this.module?":!"+this.module:null,
"foreign": {
"tbl": "fac_module",
"key": "fac_module_name",
@@ -62,6 +62,7 @@ function model_fac_functie (functie_key, params)
"label": L("fac_functie_min_level"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_min_levelLOV"),
"hidden_fld": true
},
"discipline": {
@@ -69,6 +70,7 @@ function model_fac_functie (functie_key, params)
"label": L("fac_functie_discipline"),
"readonly": true,
"typ": "number",
"LOV": "0;Globaal;1;Per discipline",
"hidden_fld": true
},
"nn_discipline": {
@@ -111,14 +113,15 @@ function model_fac_functie (functie_key, params)
}
var xparams = null;
if (module)
if (params.disc_key > 0)
{
xparams = { GET: { wheres: ["fac_functie_module = " + safe.quoted_sql(module),
"fac_functie_discipline = 1" // dan ook alleen de discipline gebonden functies
] } }
}
this.REST_GET = generic_REST_GET(this, xparams);
this.REST_POST = generic_REST_POST(this);
this.REST_PUT = generic_REST_PUT(this);
this.REST_DELETE = generic_REST_DELETE(this);
//this.REST_POST = generic_REST_POST(this);
//this.REST_PUT = generic_REST_PUT(this);
//this.REST_DELETE = generic_REST_DELETE(this);
}
%>

View File

@@ -272,63 +272,7 @@ sSQL = sSQL & " AND EXISTS"&_
" OR ff.fac_functie_code = 'WEB_' || m.fac_module_name || 'MSU'"&_
" ))"
if getParam("FAC_GROEP_KEY") <> "" then
fldFAC_GROEP_KEY = getParam("FAC_GROEP_KEY")
end if
sqlGroepOmschr = "select fac_groep_omschrijving from fac_groep where fac_groep_key = " & ToSQL(fldFAC_GROEP_KEY, "Number")
openrs rsGroep,sqlGroepOmschr
if not rsGroep.EOF then
sFormTitle = "Rechten van groep "& ToHTML(getValue(rsGroep,"fac_groep_omschrijving"))
end if
rsGroep.Close
transit = "?sFAC_GROEP_UPPER=" & ToURL(GetParam("sFAC_GROEP_UPPER"))
setvar "Footer","<font class=DataFont><a href=fac_groepgrid.asp" & transit & ">"&FCLTLCL("Terug naar overzicht")&"</a></font>"
----------------------------
Page event show:
if ((fldFAC_FUNCTIE_DISCIPLINE = "") or (fldFAC_FUNCTIE_DISCIPLINE="0")) then
'Autorisatie is op functie niveau. Kijk of er al autorisaties aangegeven zijn.
sqlGroepRechten = "select * from fac_groeprechten where fac_groep_key = " & ToSQL(fldFAC_GROEP_KEY, "Number")&" and fac_functie_key = " & ToSQL(fldFAC_FUNCTIE_KEY, "Number")
openrs rsGroepRechten,sqlGroepRechten
if not rsGroepRechten.EOF then
'Autorisaties bestaan
prs_read = decode_org_level(getValue(rsGroepRechten,"fac_gebruiker_prs_level_read"))
prs_write = decode_org_level(getValue(rsGroepRechten,"fac_gebruiker_prs_level_write"))
alg_read = decode_pos_level(getValue(rsGroepRechten,"fac_gebruiker_alg_level_read"))
alg_write = decode_pos_level(getValue(rsGroepRechten,"fac_gebruiker_alg_level_write"))
fldFAC_GEBRUIKER_PRS_LEVEL_READ = prs_read
fldFAC_GEBRUIKER_PRS_LEVEL_WRITE = prs_write
fldFAC_GEBRUIKER_ALG_LEVEL_READ = alg_read
fldFAC_GEBRUIKER_ALG_LEVEL_WRITE = alg_write
fldFAC_FUNCTIE_OMSCHRIJVING_FAC_GROEPRECHTEN_KEY = getValue(rsGroepRechten,"fac_groeprechten_key")
else
fldFAC_GEBRUIKER_PRS_LEVEL_READ = FCLTLCL("Geen")
fldFAC_GEBRUIKER_PRS_LEVEL_WRITE = FCLTLCL("Geen")
fldFAC_GEBRUIKER_ALG_LEVEL_READ = FCLTLCL("Geen")
fldFAC_GEBRUIKER_ALG_LEVEL_WRITE = FCLTLCL("Geen")
fldFAC_FUNCTIE_OMSCHRIJVING_FAC_GROEPRECHTEN_KEY = ""
end if
rsGroepRechten.Close
else
'autorisatie is op discipline niveau
s_filter = ""
if getParam("FAC_FUNCTIE_MODULE") <> "" then
s_filter = "&fac_functie_module_filter="& ToURL(getParam("FAC_FUNCTIE_MODULE"))
end if
details = "<a href=fac_authgroepdisciplinegrid.asp?"&_
"fac_functie_key=" & ToSQL(fldFAC_FUNCTIE_KEY, "Number") &_
"&fac_groep_key=" & ToSQL(fldFAC_GROEP_KEY, "Number") &_
"&fac_functie_module="& ToURL(fldFAC_FUNCTIE_MODULE)&s_filter &_
"&sFAC_GROEP_UPPER="& ToURL(getParam("sFAC_GROEP_UPPER")) &">"
fldFAC_FUNCTIE_OMSCHRIJVING = "<font class=""DataFont"">"&fldFAC_FUNCTIE_OMSCHRIJVING&"</font>"
fldFAC_FUNCTIE_OMSCHRIJVING = "</a>"&details&fldFAC_FUNCTIE_OMSCHRIJVING&"</a>"
fldFAC_GEBRUIKER_PRS_LEVEL_READ = "..."
fldFAC_GEBRUIKER_PRS_LEVEL_WRITE = "..."
fldFAC_GEBRUIKER_ALG_LEVEL_READ = "..."
fldFAC_GEBRUIKER_ALG_LEVEL_WRITE = "..."
end if
----------------------------
Page event customsecurity:
@@ -348,62 +292,5 @@ sSQL = sSQL & " AND EXISTS"&_
" OR ff.fac_functie_code = 'WEB_' || m.fac_module_name || 'MSU'"&_
" ))"
if getParam("FAC_GROEP_KEY") <> "" then
fldFAC_GROEP_KEY = getParam("FAC_GROEP_KEY")
end if
sqlGroepOmschr = "select fac_groep_omschrijving from fac_groep where fac_groep_key = " & ToSQL(fldFAC_GROEP_KEY, "Number")
openrs rsGroep,sqlGroepOmschr
if not rsGroep.EOF then
sFormTitle = "Rechten van groep "& ToHTML(getValue(rsGroep,"fac_groep_omschrijving"))
end if
rsGroep.Close
transit = "?sFAC_GROEP_UPPER=" & ToURL(GetParam("sFAC_GROEP_UPPER"))
setvar "Footer","<font class=DataFont><a href=fac_groepgrid.asp" & transit & ">"&FCLTLCL("Terug naar overzicht")&"</a></font>"
----------------------------
Form event show:
if ((fldFAC_FUNCTIE_DISCIPLINE = "") or (fldFAC_FUNCTIE_DISCIPLINE="0")) then
'Autorisatie is op functie niveau. Kijk of er al autorisaties aangegeven zijn.
sqlGroepRechten = "select * from fac_groeprechten where fac_groep_key = " & ToSQL(fldFAC_GROEP_KEY, "Number")&" and fac_functie_key = " & ToSQL(fldFAC_FUNCTIE_KEY, "Number")
openrs rsGroepRechten,sqlGroepRechten
if not rsGroepRechten.EOF then
'Autorisaties bestaan
prs_read = decode_org_level(getValue(rsGroepRechten,"fac_gebruiker_prs_level_read"))
prs_write = decode_org_level(getValue(rsGroepRechten,"fac_gebruiker_prs_level_write"))
alg_read = decode_pos_level(getValue(rsGroepRechten,"fac_gebruiker_alg_level_read"))
alg_write = decode_pos_level(getValue(rsGroepRechten,"fac_gebruiker_alg_level_write"))
fldFAC_GEBRUIKER_PRS_LEVEL_READ = prs_read
fldFAC_GEBRUIKER_PRS_LEVEL_WRITE = prs_write
fldFAC_GEBRUIKER_ALG_LEVEL_READ = alg_read
fldFAC_GEBRUIKER_ALG_LEVEL_WRITE = alg_write
fldFAC_FUNCTIE_OMSCHRIJVING_FAC_GROEPRECHTEN_KEY = getValue(rsGroepRechten,"fac_groeprechten_key")
else
fldFAC_GEBRUIKER_PRS_LEVEL_READ = FCLTLCL("Geen")
fldFAC_GEBRUIKER_PRS_LEVEL_WRITE = FCLTLCL("Geen")
fldFAC_GEBRUIKER_ALG_LEVEL_READ = FCLTLCL("Geen")
fldFAC_GEBRUIKER_ALG_LEVEL_WRITE = FCLTLCL("Geen")
fldFAC_FUNCTIE_OMSCHRIJVING_FAC_GROEPRECHTEN_KEY = ""
end if
rsGroepRechten.Close
else
'autorisatie is op discipline niveau
s_filter = ""
if getParam("FAC_FUNCTIE_MODULE") <> "" then
s_filter = "&fac_functie_module_filter="& ToURL(getParam("FAC_FUNCTIE_MODULE"))
end if
details = "<a href=fac_authgroepdisciplinegrid.asp?"&_
"fac_functie_key=" & ToSQL(fldFAC_FUNCTIE_KEY, "Number") &_
"&fac_groep_key=" & ToSQL(fldFAC_GROEP_KEY, "Number") &_
"&fac_functie_module="& ToURL(fldFAC_FUNCTIE_MODULE)&s_filter &_
"&sFAC_GROEP_UPPER="& ToURL(getParam("sFAC_GROEP_UPPER")) &">"
fldFAC_FUNCTIE_OMSCHRIJVING = "<font class=""DataFont"">"&fldFAC_FUNCTIE_OMSCHRIJVING&"</font>"
fldFAC_FUNCTIE_OMSCHRIJVING = "</a>"&details&fldFAC_FUNCTIE_OMSCHRIJVING&"</a>"
fldFAC_GEBRUIKER_PRS_LEVEL_READ = "..."
fldFAC_GEBRUIKER_PRS_LEVEL_WRITE = "..."
fldFAC_GEBRUIKER_ALG_LEVEL_READ = "..."
fldFAC_GEBRUIKER_ALG_LEVEL_WRITE = "..."
end if
*/
%>

View File

@@ -20,8 +20,8 @@ function model_ins_tab_discipline(disc_key, params)
{
this.table = "ins_tab_discipline";
this.primary = "ins_discipline_key";
this.records_name = "reservationcatalogs";
this.record_name = "reservationcatalog";
this.records_name = "disciplines";
this.record_name = "discipline";
this.fields = {
"id": {
"dbs": "ins_discipline_key",
@@ -141,6 +141,7 @@ function model_ins_tab_discipline(disc_key, params)
if (params.functie_key > 0)
{
this.module = Oracle.Get("fac_functie_module", "fac_functie", params.functie_key);
this.level = Oracle.Get("fac_functie_min_level", "fac_functie", params.functie_key);
xparams = { GET: { wheres: ["ins_discipline_module = " + safe.quoted_sql(this.module)] } }
}

View File

@@ -32,6 +32,7 @@ var fdisc = oRs("fac_functie_discipline").Value;
if (fdisc)
var disc_key = getQParamInt("ins_discipline");
var fdesc = oRs("fac_functie_omschrijving").Value;
var finfo = oRs("fac_functie_info").Value;
oRs.Close();
var sql = "SELECT * "
@@ -42,15 +43,40 @@ var gdesc = oRs("fac_groep_omschrijving").Value;
var gremark = oRs("fac_groep_opmerking").Value;
oRs.Close();
function radioTD(name, label, LOV, val)
var transitParam = buildTransitParam(["fac_groep", "fac_functie", "ins_discipline"]);
var prsread = 9;
var prswrite = 9;
var algread = 9;
var algwrite = 9;
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)
{
Response.Write("\n<td><label>" + label + "</label>");
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;
var algwrite = oRs("fac_gebruiker_alg_level_write").Value;
}
oRs.Close();
function radioTD(name, LOV, val)
{
Response.Write("\n<td style='width:130px'>");
for (var i in LOV)
{
Response.Write("\n<br><label><input name=\"" + name + "\" type=\"radio\" value=\"" + i + "\""
Response.Write("\n<label><input id=\"" + name + "\" name=\"" + name + "\" type=\"radio\" value=\"" + i + "\""
+ ((i == val)?" checked":"")
+">");
Response.Write(safe.html(LOV[i]) + "</label>");
Response.Write(safe.html(LOV[i]) + "</label><br>");
}
Response.Write("</td>");
@@ -59,8 +85,6 @@ function radioTD(name, label, LOV, val)
<html>
<head>
<% FCLTHeader.Generate()
%>
<script>
function grp_submit()
@@ -71,16 +95,96 @@ function radioTD(name, label, LOV, val)
$.post($("form[name=u2]")[0].action, $("[name=u2]").serialize(), FcltCallbackClose, "json");
return true; // disable button
}
function auth_advanced(adv)
{
window.location.href = "fac_edit_groeprechten.asp?advanced=" + adv + "<%=transitParam%>";
}
function onchange ()
{
var val = $(this).val();
switch (this.id)
{
case "prsread":
if ($("[name=prswrite]:checked").val() < val)
$("[name=prswrite][value="+val+"]").prop('checked', true); // FireFox doet hier niets als ik #prswrite gebruik?
if (val == 9)
$("#algread[value=9],#algwrite[value=9]").prop('checked', true);
if (val < 9)
{
var algread = $("[name=algread]:checked").val();
if (algread == 9)
$("[name=algread][value=-1]").prop('checked', true);
}
break;
case "prswrite":
if ($("[name=prsread]:checked").val() > val)
{
var prs = $("[name=prsread][value="+val+"]").prop('checked', true);
onchange.apply(prs[0]);
}
if (val < 9)
{
var algwrite = $("[name=algwrite]:checked").val();
if (algwrite == 9)
{
var algread = $("[name=algread]:checked").val()
var alg = $("[name=algwrite][value=" + algread + "]").prop('checked', true);
onchange.apply(alg[0]);
}
}
else
$("[name=algwrite][value=9]").prop('checked', true);
break;
case "algread":
if (val < 9)
{
var prsread = $("[name=prsread]:checked").val();
if (prsread == 9)
$("[name=prsread][value=-1]").prop('checked', true);
}
if ($("[name=algwrite]:checked").val() < val)
$("[name=algwrite][value="+val+"]").prop('checked', true);
if (val == 9)
$("#prsread[value=9],#prswrite[value=9]").prop('checked', true);
break;
case "algwrite":
if ($("[name=algread]:checked").val() > val)
{
var alg = $("[name=algread][value="+val+"]").prop('checked', true);
onchange.apply(alg[0]);
}
if (val < 9)
{
var prswrite = $("[name=prswrite]:checked").val();
if (prswrite == 9)
{
var prsread = $("[name=prsread]:checked").val()
var prs = $("[name=prswrite][value=" + prsread + "]").prop('checked', true);
onchange.apply(prs[0]);
}
}
else
$("[name=prswrite][value=9]").prop('checked', true);
break;
}
}
$(function ()
{ // Zorg dat er altijd zinvolle combinaties overblijven
$("#prsread,#prswrite,#algread,#algwrite").change(onchange)
}
)
</script>
</head>
<body class="modal" id="mod_grprecht">
<form name="u2" action="fac_edit_groeprechten_save.asp" method="post">
<% BLOCK_START("grpRechten", L("lcl_res_deel_head1"));
<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%>'>
<% 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));
@@ -88,74 +192,97 @@ function radioTD(name, label, LOV, val)
var algLOV = api2.splitLOV(buildAlgLevelLOV());
var jnLOV = { "-1": L("lcl_Yes"), "9": L("lcl_No") };
var prsread = 9;
var prswrite = 9;
var algread = 9;
var algwrite = 9;
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);
if (!oRs.Eof)
{
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;
var algwrite = oRs("fac_gebruiker_alg_level_write").Value;
}
oRs.Close();
// 0 is Ja/Nee
// 1 is Ja/Nee (alleen FAC_FAQUSE en PRS_MODAAN)
// 3 is Lees Ja/Nee en Schrijf Ja/Nee
// 7 is PRS lezen/schrijven WEB_FACMAN en WEB_BEZPAF
// 11 is ALG lezen/schrijven diversen
// 13 is PRS+ALG lezen WEB_???BAC
// 15 is PRS+ALG lezen/schrijven diversen
// Ofwel: +1 is bedacht als afzonderlijke leesrechten. Die is wat onzinnig
// +2 is afzonderlijke schrijfrechten
// +4 is PRS-scope
// +8 is ALG-scope
var advanced = getQParamInt("advanced", 0) == 1;
if ( prsread != prswrite && (flevel & 2)
|| algread != algwrite && (flevel & 2)
|| prsread != -1 && prsread != 9
|| algread != -1 && algread != 9
)
{
advanced = true;
var no_simpel = true;
}
Response.Write("<tr><td></td><td><table><tr>");
if (flevel & 4) // PRS
if (!advanced)
{
if (prsread == prswrite)
{
radioTD("prsread", L("lcl_prs_organisatie"), prsLOV, prsread);
}
else
{
radioTD("prsread", L("fac_gebruiker_prs_level_read"), prsLOV, prsread);
radioTD("prswrite", L("fac_gebruiker_prs_level_write"), prsLOV, prswrite);
}
Response.Write("<input type='hidden' name='simple_mode' value='1'>");
var cparams = {};
if (flevel > 1)
cparams.posthtml = " <label for='allread'>({0})</label>".format(api2.splitLOV(L("fac_functie_min_levelLOV"))[flevel]);
RWCHECKBOXTR("allread", "fldcheck", L("fac_gebruiker_toegang"), algread==9?0:1, cparams)
}
if (flevel & 8) // ALG
else
{
if (flevel & 8)
Response.Write("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>")
if (algread == algwrite)
Response.Write("<tr><td colspan='2'><table><tr>");
if (!(flevel & (4 | 8))) // niet gescoped
{
radioTD("algread", L("lcl_place"), algLOV, algread);
if (flevel & 2) // Schrijfrechten
Response.Write("<tr><th>" + L("fac_gebruiker_lezen") + "</th><th>" + L("fac_gebruiker_schrijven") + "</th></tr>");
radioTD("algread", jnLOV, algread);
if (flevel & 2) // Schrijfrechten
radioTD("algwrite", jnLOV, algwrite);
}
else
{
radioTD("algread", L("fac_gebruiker_alg_level_read"), algLOV, algread);
radioTD("algwrite", L("fac_gebruiker_alg_level_write"), algLOV, algwrite);
}
}
if ((flevel & (4 + 8)) == 0)
{
if (flevel == 1)
radioTD("algread", L("fac_gebruiker_toegang"), jnLOV, algread);
else
{
radioTD("algread", L("fac_gebruiker_lezen"), jnLOV, algread);
radioTD("algwrite", L("fac_gebruiker_schrijven"), jnLOV, algwrite);
}
if (flevel & (4 | 8)) // scope kopjes
{
Response.Write("<tr>");
var spanner = "";
if (flevel & 2) // read/write kopjes
spanner = " colspan='2' style='text-align:center'";
if (flevel & 4)
Response.Write("<th" + spanner + ">" + L("lcl_prs_organisatie") + "</th>");
if (flevel & 8)
Response.Write("<th" + spanner + ">" + L("lcl_place") + "</th>");
Response.Write("</tr>");
}
if (flevel & 2) // read/write kopjes
{
Response.Write("<tr>");
Response.Write("<th>" + L("fac_gebruiker_lezen") + "</th><th>" + L("fac_gebruiker_schrijven") + "</th>");
if ((flevel & 4) && (flevel & 8))
Response.Write("<th>" + L("fac_gebruiker_lezen") + "</th><th>" + L("fac_gebruiker_schrijven") + "</th>");
Response.Write("</tr>");
}
if (flevel & 4) // PRS
{
radioTD("prsread", prsLOV, prsread);
if (flevel & 2) // Schrijfrechten
radioTD("prswrite", prsLOV, prswrite);
}
if (flevel & 8) // ALG
{
radioTD("algread", algLOV, algread);
if (flevel & 2) // Schrijfrechten
radioTD("algwrite", algLOV, algwrite);
}
}
Response.Write("</tr></table></td></tr>");
}
Response.Write("</tr></table></td></tr>");
BLOCK_END();
buttons = [];
if (flevel > 1)
{
if (advanced)
{
if (!no_simpel)
buttons.push ( {title: L("lcl_auth_simple"), action:"auth_advanced(0)" } );
}
else
buttons.push ( {title: L("lcl_auth_advanced"), action:"auth_advanced(1)" } );
}
buttons.push({ title: L("lcl_submit"), action: "grp_submit()" });
buttons.push({ title: L("lcl_cancel"), action: "gen_cancel()" });

View File

@@ -0,0 +1,101 @@
<%@language = "javascript" %>
<% /*
$Revision$
$Id$
File: fac_edit_groeprechten_save.asp.asp
Description: Het echte bewaren van een autorisatie
Parameters: fac_groep
fac_functie
ins_discipline optioneel
simplemode optioneel, 1 voor alleen 'Toegang' vinkje
Context: Vanuit fac_edit_groeprechten.asp
*/
var JSON_Result = true;
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/json2.js" -->
<!-- #include file="../Shared/save2db.inc" -->
<%
protectRequest.validateToken();
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 simple_mode = getFParamInt("simple_mode", 0) == 1;
if (simple_mode)
{
var lvl = (getFParam("allread", "off") == 'on')?-1:9;
var prsread = lvl;
var prswrite = lvl;
var algread = lvl;
var algwrite = lvl;
}
else
{
var prsread = getFParamInt("prsread", -2);
var prswrite = getFParamInt("prswrite", -2);
var algread = getFParamInt("algread", -2);
var algwrite = getFParamInt("algwrite", -2);
}
var level = Oracle.Get("fac_functie_min_level", "fac_functie", functie_key);
if (!(level & 2)) // geen aparte schrijfrechten
{
prswrite = -1;
algwrite = -1;
}
if (level & ( 4 | 8))
{
if (!(level & 4)) // geen PRS scope
{
prsread = -1;
prswrite = algwrite < 9?-1:9; // waarschijnlijk don't care
}
if (!(level & 8)) // geen ALG scope
{
algread = -1;
algwrite = prswrite < 9?-1:9; // waarschijnlijk don't care
}
}
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
{
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 },
{ dbs: "fac_gebruiker_alg_level_write", typ: "number", val: algwrite }
]
if (gr_key > -1)
{
var sql = buildUpdate("fac_groeprechten", fields)
+ " fac_groeprechten_key = " + gr_key;
Oracle.Execute(sql);
}
else
{
fields.push({ dbs: "fac_functie_key", typ: "key", val: functie_key },
{ dbs: "fac_groep_key", typ: "key", val: groep_key },
{ dbs: "ins_discipline_key", typ: "key", val: disc_key }
);
var grpIns = buildInsert("fac_groeprechten", fields);
Oracle.Execute(grpIns.sql);
}
}
var result = {success: true };
Response.Write(JSON.stringify(result));
Response.End;
%>

View File

@@ -9,11 +9,11 @@
var disc_key = getQParamInt("ins_discipline", -1);
var model = new model_fac_functie(null, { groep_key: groep_key, disc_key: disc_key });
settings.overrule_setting("qp_maxrows", 250); // Toon alle 186 (2015.6) functies direkt
settings.overrule_setting("qp_maxrows", 250); // Toon alle 186 (DB28) functies direct
function fnrowData(oRs)
{
var funcdisc = oRs.Fields("discipline").Value;
var funcdisc = oRs.Fields("discipline").Value.id;
var data = {funcdisc: funcdisc, groep_key: groep_key, disc_key: disc_key};
return JSON.stringify(data);
}
@@ -54,28 +54,28 @@
};
if (groep_key > 0)
{
scf_params.search.labels.push({ "lbl": L("fac_groep"), "txt" : Oracle.Get("fac_groep_omschrijving", "fac_groep", groep_key)});
var groep_desc = Oracle.Get("fac_groep_omschrijving", "fac_groep", groep_key);
scf_params.search.title = groep_desc;
scf_params.search.labels.push({ "lbl": L("fac_groep"), "txt" : groep_desc});
scf_params.search.labels.push({ "lbl": L("fac_groep_opmerking"), "txt" : Oracle.Get("fac_groep_opmerking", "fac_groep", groep_key)});
scf_params.list.columns =
scf_params.list.columns.concat([
scf_params.list.columns.push(
"authorization.ins_discipline",
"authorization.prs_level_read",
"authorization.prs_level_write",
"authorization.alg_level_read",
"authorization.alg_level_write"
]);
);
}
if (disc_key > 0)
{
scf_params.search.labels.push({ "lbl": L("ins_discipline_key"), "txt" : Oracle.Get("ins_discipline_omschrijving", "ins_tab_discipline", "ins_discipline_key", disc_key)});
scf_params.list.columns =
scf_params.list.columns.concat([
scf_params.list.columns.push(
"authorization.fac_groep",
"authorization.prs_level_read",
"authorization.prs_level_write",
"authorization.alg_level_read",
"authorization.alg_level_write"
]);
);
}
scaffolding(model, scf_params);
%>

View File

@@ -16,7 +16,7 @@ function edit_rechten(row)
else if (funData.groep_key > 0)
{
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}".format(funData.groep_key, functie_key);
FcltMgr.openModalDetail(url, L("fac_groeprechten"));
FcltMgr.openModalDetail(url, L("fac_groeprechten"), { callback: FcltCallbackRefresh });
}
else // eerst nog een groep erbij kiezen
{

View File

@@ -65,15 +65,30 @@
if (functie_key > 0)
{
scf_params.search.labels.push({ "lbl": L("fac_functie"), "txt" : Oracle.Get("fac_functie_omschrijving", "fac_functie", functie_key)});
scf_params.list.columns =
scf_params.list.columns.concat([
//"authorization.ins_discipline",
"authorization.prs_level_read",
"authorization.prs_level_write",
"authorization.alg_level_read",
"authorization.alg_level_write"
]);
var func_desc = Oracle.Get("fac_functie_omschrijving", "fac_functie", functie_key);
scf_params.search.title = func_desc;
scf_params.search.labels.push({ "lbl": L("fac_functie"), "txt" : func_desc });
scf_params.search.labels.push({ "lbl": L("fac_functie_info"), "txt" : Oracle.Get("fac_functie_info", "fac_functie", functie_key)});
model.level = Oracle.Get("fac_functie_min_level", "fac_functie", functie_key);
if (model.level & 4)
{
scf_params.list.columns.push("authorization.prs_level_read");
if (model.level & 2)
scf_params.list.columns.push("authorization.prs_level_write");
}
if (model.level & 8)
{
scf_params.list.columns.push("authorization.alg_level_read")
if (model.level & 2)
scf_params.list.columns.push("authorization.alg_level_write");
}
if (!(model.level & (4 | 8)))
{
scf_params.list.columns.push("authorization.prs_level_read");
if (model.level & 2) // Schrijfrechten
scf_params.list.columns.push("authorization.alg_level_write");
}
}
if (disc_key > 0)
{

View File

@@ -16,7 +16,7 @@ function edit_rechten(row)
else if (grpData.functie_key > 0)
{
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}&ins_discipline={2}".format(groep_key, grpData.functie_key, grpData.disc_key);
FcltMgr.openModalDetail(url, L("fac_groeprechten"));
FcltMgr.openModalDetail(url, L("fac_groeprechten"), { callback: FcltCallbackRefresh });
}
else // eerst nog een functie erbij kiezen
{

View File

@@ -75,16 +75,31 @@
if (groep_key > 0 && functie_key > 0)
{
scf_params.search.labels.push({ "lbl": L("fac_groep"), "txt" : Oracle.Get("fac_groep_omschrijving", "fac_groep", groep_key)});
var groep_desc = Oracle.Get("fac_groep_omschrijving", "fac_groep", groep_key);
var func_desc = Oracle.Get("fac_functie_omschrijving", "fac_functie", functie_key);
scf_params.search.title = groep_desc + "/" + func_desc;
scf_params.search.labels.push({ "lbl": L("fac_groep"), "txt" : groep_desc });
scf_params.search.labels.push({ "lbl": L("fac_groep_opmerking"), "txt" : Oracle.Get("fac_groep_opmerking", "fac_groep", groep_key)});
scf_params.search.labels.push({ "lbl": L("fac_functie"), "txt" : Oracle.Get("fac_functie_omschrijving", "fac_functie", functie_key)});
scf_params.list.columns =
scf_params.list.columns.concat([
"authorization.prs_level_read",
"authorization.prs_level_write",
"authorization.alg_level_read",
"authorization.alg_level_write"
]);
scf_params.search.labels.push({ "lbl": L("fac_functie"), "txt" : func_desc});
scf_params.search.labels.push({ "lbl": L("fac_functie_info"), "txt" : Oracle.Get("fac_functie_info", "fac_functie", functie_key)});
if (model.level & 4)
{
scf_params.list.columns.push("authorization.prs_level_read");
if (model.level & 2)
scf_params.list.columns.push("authorization.prs_level_write");
}
if (model.level & 8)
{
scf_params.list.columns.push("authorization.alg_level_read")
if (model.level & 2)
scf_params.list.columns.push("authorization.alg_level_write");
}
if (!(model.level & (4 | 8)))
{
scf_params.list.columns.push("authorization.prs_level_read");
if (model.level & 2) // Schrijfrechten
scf_params.list.columns.push("authorization.alg_level_write");
}
}
scaffolding(model, scf_params);

View File

@@ -11,7 +11,7 @@ function edit_rechten(row)
if (grpData.functie_key > 0 && grpData.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);
FcltMgr.openModalDetail(url, L("fac_groeprechten"));
FcltMgr.openModalDetail(url, L("fac_groeprechten"), { callback: FcltCallbackRefresh });
}
else if (grpData.functie_key > 0)
{

View File

@@ -306,7 +306,7 @@ function buildAlgLevelLOV()
+ ";1;" + L("lcl_district")
+ ";2;" + L("lcl_location")
+ ";3;" + L("lcl_building")
+ ";4;" + L("lcl_building")
+ ";4;" + L("lcl_floor")
+ ";5;" + L("lcl_room")
+ ";9;" + L("fac_functie_auth_none");
return AlgLevelLOV;

View File

@@ -170,6 +170,8 @@ function scaffolding_search(model, scf_params)
var est_title = "";
if ("estimated_rows" in model)
est_title = " <em style='font-size:10px'>estimated {0} rows as of {1}</em>".format(model.estimated_rows, toDateTimeString(model.last_analyzed));
else
est_title = " " + model.records_title;
BLOCK_START("searchtable", L("lcl_filterblok") + est_title);

View File

@@ -414,6 +414,8 @@ function RWCHECKBOXTR(pname, pclass, plabel, pvalue, params)
%><td class="label"></td><td><%
}
CHECKBOX(pclass, pname, pvalue, params)
if (params.posthtml)
Response.Write(params.posthtml);
if (plabel) { %></td><% }
} else {
%><td colspan="2"><% CHECKBOX(pclass, pname, pvalue, params) %><%