Files
Facilitor/APPL/API2/model_fac_functie.inc
Jos Groot Lipman e7a8113048 FSN#35817 Autorisaties via API2/Scaffolding
svn path=/Website/trunk/; revision=28565
2016-03-21 21:49:14 +00:00

116 lines
3.3 KiB
C++

<% /*
$Revision$
$Id$
File: model_fac_functie.inc
Description: Dit is het model om de *rechten* van een groep voor diverse
functies te beheren.
model_fac_functie moet dan ook altijd aangroepen worden met
een fac_groep_key
Context:
Notes:
*/
%>
<!-- #include file="../api2/model_fac_groeprechten.inc" -->
<%
function model_fac_functie (functie_key, params)
{
this.table = "fac_functie";
this.primary = "fac_functie_key";
this.records_name = "fac_functies";
this.record_name = "fac_functie";
var 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;
oRs.Close();
}
this.fields = {
"id": {
"dbs": "fac_functie_key",
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
"seq": "fac_s_fac_functie_key"
},
"module": {
"dbs": "fac_functie_module",
"label": L("fac_functie_module"),
"readonly": true,
"typ": "varchar",
"filterdefault": module?":!"+module:null,
"foreign": {
"tbl": "fac_module",
"key": "fac_module_name",
"desc": "fac_module_name || ' - ' || fac_module_remark"
}
},
"name": {
"dbs": "fac_functie_code",
"label": L("fac_functie_code"),
"readonly": true,
"typ": "varchar"
},
"level": {
"dbs": "fac_functie_min_level",
"label": L("fac_functie_min_level"),
"readonly": true,
"typ": "number",
"hidden_fld": true
},
"discipline": {
"dbs": "fac_functie_discipline",
"label": L("fac_functie_discipline"),
"readonly": true,
"typ": "number",
"hidden_fld": true
},
"description": {
"dbs": "fac_functie_omschrijving",
"label": L("fac_functie_omschrijving"),
"typ": "varchar",
"readonly": true,
"required": true
},
"info": {
"dbs": "fac_functie_info",
"label": L("fac_functie_info"),
"readonly": true,
"typ": "varchar"
}
};
if (params.groep_key > 0 || params.disc_key > 0)
{
this.includes = {"authorization":
{ "model": new model_fac_groeprechten(params),
"joinfield": "fac_functie"
}};
}
this.autfunction = "WEB_PRSMSU";
this.record_title = L("fac_functie");
this.records_title = L("fac_functie_m");
this.edit = {
"modal": true
}
var xparams = null;
if (module)
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);
}
%>