DCOL#36593 autorisatiegroepsrechten worden overruled

svn path=/Website/trunk/; revision=30406
This commit is contained in:
Erik Groener
2016-08-24 13:22:15 +00:00
parent 56d94c90cf
commit 340c4aeed6
2 changed files with 37 additions and 5 deletions

View File

@@ -656,7 +656,7 @@ cnt = { setcontractstatus:
? " c.cnt_contract_status"
+ " , decode(cnt.cnt_contract_status (c.cnt_contract_looptijd_van, cnt.cnt_getRappeldatum (c.cnt_contract_key), cnt.cnt_getOpzegdatum (c.cnt_contract_key), c.cnt_contract_looptijd_tot), 4, 2, 1)"
+ " , c.cnt_contract_looptijd_tot"
: " c.cnt_contract_looptijd_tot")
: " c.cnt_contract_looptijd_tot")
+ " , c.cnt_contract_nummer")
+ " , c.cnt_contract_nummer_intern";
@@ -847,7 +847,7 @@ cnt = { setcontractstatus:
+ " , dp.cnt_srtcontract_type"
+ " , cc.cnt_contract_mantel_key"
+ " , mc.cnt_contract_nummer_intern mantelcontractnummer"
+ " , mc.cnt_contract_omschrijving mantelomschrijving"
+ " , mc.cnt_contract_omschrijving mantelomschrijving"
+ " , (SELECT COUNT(*) FROM cnt_contract_plaats ccp WHERE ccp.cnt_contract_key = cc.cnt_contract_key) nnScope"
+ " , bdp.bes_disc_params_contract"
+ " FROM cnt_contract cc"
@@ -968,12 +968,32 @@ cnt = { setcontractstatus:
loc_arr.push(ors_loc_key);
oRs_loc.MoveNext();
}
oRs_loc.Close();
// Alleen personen met rechten op de afdelingen van de contracten mogen deze inzien.
// Daarvoor hebben we de afdeling van het contract nodig.
var sql_afd = "SELECT k.prs_afdeling_key"
+ " FROM cnt_contract c"
+ " , prs_afdeling k"
+ " WHERE c.prs_kostenplaats_key = k.prs_kostenplaats_key"
+ " AND c.cnt_contract_key = " + pcnt_contract_key;
var oRs_afd = Oracle.Execute(sql_afd);
var afd_arr = [];
while (!oRs_afd.eof)
{
var ors_afd_key = oRs_afd("prs_afdeling_key").Value;
if (ors_afd_key)
afd_arr.push(ors_afd_key);
oRs_afd.MoveNext();
}
oRs_afd.Close();
// Als een contract geen locaties heeft dan heb je alle rechten op dat contract.
var cresult = user.func_enabled2("CNT",
{ ins_discipline_key: cnt_info.discipline_key,
loc_key: loc_arr,
prs_key: user_key, // key_eig, // TODO: Vind de juiste perslid. Je hebt prs_afdeling_key_eig
afd_key: afd_arr,
checkOptimistic: false, // checkOptimistic
isOptional: true
});

View File

@@ -1086,6 +1086,13 @@ Perslid.prototype.func_enabled2 = function _func_enabled2(module, params)
// params.alg_key is geen array.
loc_key_array.push(params.loc_key);
}
var afd_key_array = [];
if (typeof params.afd_key == "object" && params.afd_key instanceof Array)
// params.afd_key is een array.
afd_key_array = params.afd_key;
else if (params.afd_key > 0)
// params.afd_key is een enkele key.
afd_key_array.push(params.afd_key);
// twee vars die aangeven hoe dichtbij parameters alg_key en prs_key bij 'onszelf' zitten.
// alglevel=5 geeft bijvoorbeeld aan dat wij een werkplek hebben op alg_key
@@ -1171,7 +1178,7 @@ Perslid.prototype.func_enabled2 = function _func_enabled2(module, params)
// TODO: Bedrijf niveau ondersteunen?
if (PRSLevel == -2 && params.prs_key)
{
if (params.prs_key == user_key)
if (params.prs_key == user_key && afd_key_array.length == 0)
PRSLevel = 8;
else
{
@@ -1181,9 +1188,14 @@ Perslid.prototype.func_enabled2 = function _func_enabled2(module, params)
+ " FROM prs_v_afdeling_familie a, prs_v_afdeling_familie aa"
+ " WHERE a.prs_afdeling_key = " + afd_key // -- de ander
+ " AND a.prs_afdeling_elder_key = aa.prs_afdeling_elder_key"
+ " AND aa.prs_afdeling_key = " + this.prs_afdeling_key(); // zelf
+ " AND aa.prs_afdeling_key = " + this.prs_afdeling_key() // zelf
+ (afd_key_array.length > 0
? " AND aa.prs_afdeling_key IN (" + afd_key_array.join(",") + ")"
: "");
var oRs2 = Oracle.Execute(sql);
PRSLevel = oRs2("niveau").value || -2;
PRSLevel = (oRs2("niveau").Value == null
? (afd_key_array.length > 0 ? -1 : -2)
: oRs2("niveau").Value);
oRs2.Close();
__Log("PRSLevel vastgesteld op: " + PRSLevel);
}