111 lines
3.7 KiB
PHP
111 lines
3.7 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: model_fac_groep.inc
|
|
|
|
Description: Model voor fac_groep
|
|
|
|
Context:
|
|
|
|
Notes:
|
|
*/
|
|
%>
|
|
<!-- #include file="model_fac_gebruikersgroep.inc" -->
|
|
<!-- #include file="model_fac_groeprechten.inc" -->
|
|
<%
|
|
|
|
function model_fac_groep(groep_key, params)
|
|
{
|
|
this.records_name = "authorizationgroups";
|
|
this.record_name = "authorizationgroup";
|
|
this.table = "fac_groep";
|
|
this.audit = { // Parameters voor fac_audit.
|
|
"childtable": "fac_groeprechten",
|
|
"childaudit": {"sql": "SELECT fac_groeprechten_key"
|
|
+ " FROM fac_groeprechten"
|
|
+ " WHERE fac_groep_key IN ({0})",
|
|
"key": "fac_groeprechten_key"
|
|
}
|
|
};
|
|
this.primary = "fac_groep_key";
|
|
this.autfunction = "WEB_FACMSU";
|
|
this.record_title = L("fac_groep");
|
|
this.records_title = L("fac_groep_m");
|
|
|
|
this.fields = {
|
|
"id": {
|
|
"dbs": "fac_groep_key",
|
|
"label": L("lcl_key"),
|
|
"typ": "key",
|
|
"required": true,
|
|
"seq": "fac_s_fac_groep_key"
|
|
},
|
|
"name": {
|
|
"dbs": "fac_groep_omschrijving",
|
|
"label": L("fac_groep_omschrijving"),
|
|
"typ": "varchar",
|
|
"required": true
|
|
},
|
|
"remark": {
|
|
"dbs": "fac_groep_opmerking",
|
|
"label": L("fac_groep_opmerking"),
|
|
"typ": "memo"
|
|
},
|
|
"substitutes": {
|
|
"dbs": "fac_groep_collega",
|
|
"label": L("lcl_prs_substitutes"),
|
|
"typ": "check0"
|
|
},
|
|
"membercount": {
|
|
"dbs": "nn_leden",
|
|
"sql": "(SELECT COUNT(*) FROM fac_gebruikersgroep WHERE fac_groep.fac_groep_key = fac_gebruikersgroep.fac_groep_key)",
|
|
"label": L("fac_groep_nn_leden"),
|
|
"typ": "number"
|
|
}
|
|
}
|
|
|
|
this.includes = {
|
|
"users": {
|
|
"model": new model_fac_gebruikersgroep(),
|
|
"joinfield": "authorizationgroup",
|
|
"multiadd": "person"
|
|
}
|
|
};
|
|
|
|
if (params.functie_key > 0)
|
|
{
|
|
this.includes["authorization"]
|
|
= {
|
|
"model": new model_fac_groeprechten(params),
|
|
"joinfield": "authorizationgroup",
|
|
outertoggle: { def: false, lbl: L("fac_gebruiker_outergroep") }
|
|
};
|
|
}
|
|
|
|
// Groepen met WEB_FACFAC en WEB_FACTAB zie je niet als je die rechten niet zelf hebt
|
|
var xparams = { GET: { wheres: [] } }
|
|
if (!user || !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 || !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);
|
|
}
|
|
%> |