FSN#35817 Autorisaties via API2/Scaffolding: Opschonen en FACFAC en FACTAB uitsluiten

svn path=/Website/trunk/; revision=28700
This commit is contained in:
Jos Groot Lipman
2016-03-31 09:23:22 +00:00
parent 48441b17b2
commit a2fb685d34
8 changed files with 77 additions and 48 deletions

View File

@@ -36,7 +36,6 @@ function model_fac_functie (functie_key, params)
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
"seq": "fac_s_fac_functie_key"
},
"module": {
@@ -81,13 +80,6 @@ function model_fac_functie (functie_key, params)
"LOV": "0;Personal;1;Professional;2;Application management;null;Other",
"hidden_fld": true
},
"nn_discipline": {
"dbs": "nn_discipline",
//"label": L("fac_functie_omschrijving"),
"typ": "varchar",
"sql": "(SELECT COUNT(*) FROM ins_tab_discipline WHERE ins_discipline_verwijder IS NULL AND ins_discipline_module = fac_functie_module)",
"hidden_fld": true
},
"description": {
"dbs": "fac_functie_omschrijving",
"label": L("fac_functie_omschrijving"),
@@ -120,12 +112,16 @@ function model_fac_functie (functie_key, params)
"modal": true
}
var xparams = null;
var xparams = { GET: { wheres: [] } }
if (params.disc_key > 0)
{
xparams = { GET: { wheres: ["fac_functie_module = " + safe.quoted_sql(this.module),
"fac_functie_discipline = 1" // dan ook alleen de discipline gebonden functies
] } }
xparams.GET.wheres.push("fac_functie_module = " + safe.quoted_sql(this.module),
"fac_functie_discipline = 1" // dan ook alleen de discipline gebonden functies
);
}
if (!user.has("WEB_FACFAC"))
{
xparams.GET.wheres.push("fac_functie_code NOT IN ('WEB_FACFAC', 'WEB_FACTAB')");
}
this.REST_GET = generic_REST_GET(this, xparams);
//this.REST_POST = generic_REST_POST(this);

View File

@@ -27,21 +27,18 @@ function model_fac_groep(groep_key, params)
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
"seq": "fac_s_fac_groep_key"
},
"name": {
"dbs": "fac_groep_omschrijving",
"label": L("fac_groep_omschrijving"),
"typ": "varchar",
"filter": "like",
"required": true
},
"remark": {
"dbs": "fac_groep_opmerking",
"label": L("fac_groep_opmerking"),
"typ": "memo",
"filter": "like"
"typ": "memo"
},
"substitutes": {
"dbs": "fac_groep_collega",
@@ -71,7 +68,27 @@ function model_fac_groep(groep_key, params)
this.record_title = L("fac_groep");
this.records_title = L("fac_groep_m");
this.REST_GET = generic_REST_GET(this);
// Groepen met WEB_FACFAC en WEB_FACTAB zie je niet als je die rechten niet zelf hebt
var xparams = { GET: { wheres: [] } }
if (!user.has("WEB_FACFAC"))
{
xparams.GET.wheres.push( "fac_groep.fac_groep_key NOT IN"
+ " (SELECT fac_groep_key"
+ " FROM fac_groeprechten fgr,"
+ " fac_functie ff"
+ " WHERE fgr.fac_functie_key = ff.fac_functie_key"
+ " AND ff.fac_functie_code = 'WEB_FACFAC')");
}
if (!user.has("WEB_FACTAB"))
{
xparams.GET.wheres.push( "fac_groep.fac_groep_key NOT IN"
+ " (SELECT fac_groep_key"
+ " FROM fac_groeprechten fgr,"
+ " fac_functie ff"
+ " WHERE fgr.fac_functie_key = ff.fac_functie_key"
+ " AND ff.fac_functie_code = 'WEB_FACTAB')");
}
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);

View File

@@ -8,7 +8,7 @@
Context:
Notes: Vooralsnog alleen gebruikt voor autorisie bewerkingen
Notes: Vooralsnog alleen gebruikt voor autorisatie bewerkingen
Zou waarschijnlijk als basis kunnen dienen voor de diverse
'discipline' van modules
*/
@@ -28,7 +28,6 @@ function model_ins_tab_discipline(disc_key, params)
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
"seq": "ins_s_ins_discipline_key"
},
"module": {
@@ -52,8 +51,7 @@ function model_ins_tab_discipline(disc_key, params)
"tbl": "ins_srtdiscipline",
"key": "ins_srtdiscipline_key",
"desc": "ins_srtdiscipline_omschrijving"
},
"filter": "like"
}
},
"ins_discipline_min_level": {
"dbs": "ins_discipline_min_level",
@@ -68,7 +66,6 @@ function model_ins_tab_discipline(disc_key, params)
"dbs": "ins_discipline_omschrijving",
"label": L("ins_discipline_omschrijving"),
"typ": "varchar",
"filter": "like",
"translate": true,
"required": true
},
@@ -115,14 +112,6 @@ function model_ins_tab_discipline(disc_key, params)
"sequence"
]
};
this.search = {
"autosearch": true,
"filters": [
"ins_discipline_min_level",
"costtype",
"name"
]
};
if (params.groep_key > 0 && params.functie_key > 0)
{

View File

@@ -1,4 +1,17 @@
<%@language = "javascript" %>
<% /*
$Revision$
$Id$
File: fac_functie.asp
Description: Ingang via functies om autorisaties te beheren
Context: Vanuit het menu
Notes:
*/
%>
<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../mgt/mgt_tools.inc" -->
@@ -13,8 +26,7 @@
function fnrowData(oRs)
{
var funcdisc = oRs.Fields("discipline").Value.id;
var data = {funcdisc: funcdisc, groep_key: groep_key, disc_key: disc_key};
var data = { funcdisc: oRs.Fields("discipline").Value.id };
return JSON.stringify(data);
}
@@ -24,7 +36,8 @@
"autosearch": !!model.module,
"labels" : [],
"filters": [
"module"
"module",
"description"
]
},
"list": {
@@ -33,8 +46,7 @@
//"module",
"name",
"description",
"discipline",
"level"
"discipline"
],
"orderby": [
"module",
@@ -45,7 +57,8 @@
"fnRowData": fnrowData,
"requires": {
js: ["./fac_functie.js"]
}
},
"script": "window.groep_key = " + groep_key + "; window.disc_key = " + disc_key
},
"transit": {
"fac_groep": groep_key,

View File

@@ -8,19 +8,19 @@ function edit_rechten(row)
var functie_key = row.getAttribute("ROWKEY");
var funData = eval("(" + row.getAttribute("ROWDATA") + ")");
if (funData.groep_key > 0 && funData.funcdisc) // naar het overzicht per discipline
if (window.groep_key > 0 && funData.funcdisc) // naar het overzicht per discipline
{
var url = "appl/mgt/ins_tab_discipline.asp?fac_groep=" + funData.groep_key + "&fac_functie=" + functie_key;
var url = "appl/mgt/ins_tab_discipline.asp?fac_groep=" + window.groep_key + "&fac_functie=" + functie_key;
FcltMgr.openDetail(url, { reuse: true });
}
else if (funData.groep_key > 0)
else if (window.groep_key > 0)
{
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}".format(funData.groep_key, functie_key);
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}".format(window.groep_key, functie_key);
FcltMgr.openModalDetail(url, L("fac_groeprechten"), { callback: FcltCallbackRefresh });
}
else // eerst nog een groep erbij kiezen
{
var url = "appl/mgt/fac_groep.asp?fac_functie=" + functie_key + "&ins_discipline=" + funData.disc_key;
var url = "appl/mgt/fac_groep.asp?fac_functie=" + functie_key + "&ins_discipline=" + window.disc_key;
FcltMgr.openDetail(url, { reuse: true });
}

View File

@@ -1,4 +1,17 @@
<%@language = "javascript" %>
<% /*
$Revision$
$Id$
File: fac_groep.asp
Description: Ingang via groepen om autorisaties te beheren
Context: Vanuit het menu
Notes:
*/
%>
<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../mgt/mgt_tools.inc" -->
@@ -12,9 +25,7 @@
function fnrowData(oRs)
{
var funcdisc = (functie_key > 0) && model.includes.authorization.model.hasdisc;
var data = {funcdisc: funcdisc, functie_key: functie_key, disc_key: disc_key};
var data = { funcdisc: (functie_key > 0) && model.includes.authorization.model.hasdisc };
return JSON.stringify(data);
}
@@ -38,6 +49,7 @@
"requires": {
js: ["./fac_groep.js"]
},
"script": "window.functie_key = " + functie_key + "; window.disc_key = " + disc_key,
"fnRowData": fnrowData,
"default_action": "edit_rechten",
// Via een knop de originele mode=wrap ondersteunen

View File

@@ -8,14 +8,14 @@ function edit_rechten(row)
var groep_key = row.getAttribute("ROWKEY");
var grpData = eval("(" + row.getAttribute("ROWDATA") + ")");
if (grpData.functie_key > 0 && grpData.funcdisc) // naar het overzicht per discipline
if (window.functie_key > 0 && grpData.funcdisc) // naar het overzicht per discipline
{
var url = "appl/mgt/ins_tab_discipline.asp?fac_groep=" + groep_key + "&fac_functie=" + grpData.functie_key;
var url = "appl/mgt/ins_tab_discipline.asp?fac_groep=" + groep_key + "&fac_functie=" + window.functie_key;
FcltMgr.openDetail(url, { reuse: true });
}
else if (grpData.functie_key > 0)
else if (window.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);
var url = "fac_edit_groeprechten.asp?fac_groep={0}&fac_functie={1}&ins_discipline={2}".format(groep_key, window.functie_key, window.disc_key);
FcltMgr.openModalDetail(url, L("fac_groeprechten"), { callback: FcltCallbackRefresh });
}
else // eerst nog een functie erbij kiezen

View File

@@ -789,6 +789,8 @@ Perslid.prototype.checkAutorisation = function checkAutorisation(autfunction, is
{
return this.checkAutorisation_readit_memoized(autfunction, isOptional, ins_discipline_key, checkPessimistic);
}
// Leesbare shortcut
Perslid.prototype.has = function(autfunction) { return this.checkAutorisation_readit_memoized(autfunction, true); }
// internal. Do not use...
Perslid.prototype.checkAutorisation_readit = function _checkAutorisation_readit(autfunction, isOptional, ins_discipline_key, checkPessimistic)