114 lines
3.4 KiB
PHP
114 lines
3.4 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: model_fac_gebruikersgroep.inc
|
|
|
|
Description: Model voor fac_gebruikersgroep
|
|
Welke gebruiker zit in welke groep?
|
|
|
|
Context:
|
|
|
|
Notes:
|
|
*/
|
|
%>
|
|
<%
|
|
|
|
function model_fac_gebruikersgroep()
|
|
{
|
|
this.table = "fac_gebruikersgroep";
|
|
this.primary = "fac_gebruikersgroep_key";
|
|
this.records_name = "usergroup";
|
|
this.record_name = "usergroups";
|
|
|
|
this.fields = {
|
|
"id": {
|
|
"dbs": "fac_gebruikersgroep_key",
|
|
"label": "Key",
|
|
"typ": "key",
|
|
"hidden_fld": true,
|
|
"required": true,
|
|
"filter": "exact",
|
|
"seq": "fac_s_fac_gebruikersgroep_key"
|
|
},
|
|
"fac_groep": {
|
|
"dbs": "fac_groep_key",
|
|
"label": L("fac_groep"),
|
|
"typ": "key",
|
|
"required": true,
|
|
"foreign": {
|
|
"tbl": "fac_groep",
|
|
"key": "fac_groep_key",
|
|
"desc": "fac_groep_omschrijving"
|
|
},
|
|
"uniquewith": "user"
|
|
},
|
|
"user": {
|
|
"dbs": "prs_perslid_key",
|
|
"label": L("prs_perslid"),
|
|
"typ": "key",
|
|
"required": true,
|
|
"foreign": "PRS_PERSLID",
|
|
"uniquewith": "fac_groep"
|
|
}
|
|
};
|
|
|
|
this.list = {
|
|
"columns": [
|
|
//"id",
|
|
"fac_groep",
|
|
"user"
|
|
]
|
|
};
|
|
this.edit = {
|
|
modal: true
|
|
};
|
|
this.autfunction = "WEB_PRSMSU";
|
|
this.record_title = L("fac_gebruikersgroep");
|
|
this.records_title = L("fac_gebruikersgroep_m");
|
|
|
|
// Lidmaatschap van groepen met PRSSYS, FACTAB en FACFAC mag je alleen
|
|
// manipuleren als je zelf die rechten hebt
|
|
this._checkprotected = function(groep_key)
|
|
{
|
|
var exclude = [];
|
|
if (!user.has("WEB_PRSSYS"))
|
|
exclude.push("WEB_PRSSYS");
|
|
if (!user.has("WEB_FACTAB"))
|
|
exclude.push("WEB_FACTAB");
|
|
if (!user.has("WEB_FACFAC"))
|
|
exclude.push("WEB_FACFAC");
|
|
if (exclude.length)
|
|
{
|
|
var sql = "SELECT fac_groep_key"
|
|
+ " FROM fac_groeprechten fgr,"
|
|
+ " fac_functie ff"
|
|
+ " WHERE fgr.fac_functie_key = ff.fac_functie_key"
|
|
+ " AND fac_groep_key = " + groep_key
|
|
+ " AND ff.fac_functie_code in (" + safe.quoted_sql_join(exclude) + ")";
|
|
var oRs = Oracle.Execute(sql);
|
|
user.auth_required_or_abort(oRs.Eof);
|
|
oRs.Close()
|
|
}
|
|
}
|
|
|
|
this.REST_GET = generic_REST_GET(this);
|
|
this.REST_POST = function (params, jsondata)
|
|
{
|
|
this._checkprotected(jsondata.fac_groep);
|
|
return generic_REST_POST(this)(params, jsondata);
|
|
}
|
|
// this.REST_PUT = generic_REST_PUT(this); // updated is wat overkill
|
|
this.REST_DELETE = function (params, the_key)
|
|
{
|
|
var sql = "SELECT fac_groep_key"
|
|
+ " FROM fac_gebruikersgroep"
|
|
+ " WHERE fac_gebruikersgroep_key = " + the_key;
|
|
var oRs = Oracle.Execute(sql);
|
|
if (!oRs.Eof)
|
|
this._checkprotected(oRs("fac_groep_key").Value);
|
|
oRs.Close();
|
|
return generic_REST_DELETE(this)(params, the_key);
|
|
}
|
|
}
|
|
%> |