FCLT#59418: Afzonderlijke autorisatiefunctie voor externe contactpersonen.
svn path=/Website/branches/v2020.1/; revision=46120
This commit is contained in:
@@ -106,7 +106,7 @@ try
|
||||
"bestelopdracht": "WEB_BESUSE",
|
||||
"afspraak": "WEB_BEZUSE",
|
||||
"contract": "WEB_CNTUSE",
|
||||
"factuur": "WEB_FINUSE",
|
||||
"factuur": "WEB_EXTFIN",
|
||||
"deel": "WEB_INSUSE",
|
||||
"melding": "WEB_MLDUSE",
|
||||
"opdracht": "WEB_MLDUSE",
|
||||
|
||||
@@ -19,7 +19,7 @@ function model_fin_factuurregel()
|
||||
this.record_name = "invoicerow";
|
||||
this.table = "fin_factuurregel";
|
||||
this.primary = "fin_factuurregel_key";
|
||||
this.autfunction = "WEB_BGTUSE"; // "WEB_FINUSE"
|
||||
this.autfunction = "WEB_BGTUSE"; // "WEB_EXTFIN"
|
||||
this.record_title = L("lcl_verkoopfactuurregel");
|
||||
this.records_title = L("fin_invoicerows");
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ model_invoicelines =
|
||||
REST_GET: function _GET(params)
|
||||
{
|
||||
var scope = params.filter.scope || "fe";
|
||||
var autfunction = { fe : user.iamContact()? ["WEB_EXTFIN","WEB_FINUSE"] : "WEB_FINUSE", fo : "WEB_FINFOF", bo : "WEB_FINBOF" } [scope];
|
||||
var autfunction = { fe: "WEB_EXTFIN", fo: "WEB_FINFOF", bo: "WEB_FINBOF" } [scope];
|
||||
params.authparams = user.checkAutorisation(autfunction, null, null, true); // pessimistisch
|
||||
|
||||
var query = api2.sqlfields(params, model_invoicelines );
|
||||
|
||||
@@ -55,10 +55,9 @@ fin = { func_enabled_factuur: // Wat mag ik zoal op deze specifieke factuur?
|
||||
// WEB_RELMAN is onderdeel van de PRS module
|
||||
var presult = user.func_enabled2("PRS", { prs_key: user_key, isOptional: true });
|
||||
|
||||
// Een user (EXTFIN of FINUSE) mag facturen zien/wijzigen onder bepaalde voorwaarden:
|
||||
// Een user (EXTFIN) mag facturen zien/wijzigen onder bepaalde voorwaarden:
|
||||
// EXTFIN: Hij mag facturen zien/wijzigen van externe bedrijven waar hij contactpersoon van is,
|
||||
// als hij ALG read/write rechten (WEB_EXTFIN) heeft op de plaats van de bijbehorende meldingsopdracht, bestellingsopdracht of contract van de factuur.
|
||||
// FINUSE: Hij mag facturen zien/wijzigen, als hij read/write rechten (WEB_FINUSE) heeft.
|
||||
// FINFOF: Hij mag facturen zien/wijzigen, als hij read/write rechten (WEB_FINFOF) heeft.
|
||||
// FINBOF: Hij mag facturen zien/wijzigen, als hij read/write rechten (WEB_FINBOF) heeft,
|
||||
// op de plaats van de bijbehorende meldingsopdracht, bestellingsopdracht of contract van de factuur.
|
||||
@@ -68,8 +67,7 @@ fin = { func_enabled_factuur: // Wat mag ik zoal op deze specifieke factuur?
|
||||
fresult.iamBedrijfContact = pfin_key > 0 && !ref_info.lev_uit_intern && user.iamContact(ref_info.lev_uit_key); // Ben ik contactpersoon van het externe uitvoerende bedrijf?
|
||||
|
||||
var EXTCanRead = fresult.iamBedrijfContact && fresult.canRead("WEB_EXTORD"); // Contactpersoon extern bedrijf (BE) + canRead.
|
||||
var USECanRead = fresult.canRead("WEB_FINUSE");
|
||||
fresult.canFERead = EXTCanRead || USECanRead;
|
||||
fresult.canFERead = EXTCanRead;
|
||||
fresult.canFORead = fresult.canRead("WEB_FINFOF");
|
||||
fresult.canBORead = fresult.canRead("WEB_FINBOF");
|
||||
fresult.canGOERead = fresult.canRead("WEB_FINGOE");
|
||||
@@ -83,8 +81,7 @@ fin = { func_enabled_factuur: // Wat mag ik zoal op deze specifieke factuur?
|
||||
authparamsMLDFIN;
|
||||
|
||||
var EXTCanWrite = fresult.iamBedrijfContact && fresult.canWrite("WEB_EXTORD"); // Contactpersoon extern bedrijf (BE) + canRead.
|
||||
var USECanWrite = fresult.canWrite("WEB_FINUSE");
|
||||
fresult.canFEWrite = EXTCanWrite || USECanWrite;
|
||||
fresult.canFEWrite = EXTCanWrite;
|
||||
fresult.canFOWrite = fresult.canWrite("WEB_FINFOF");
|
||||
fresult.canBOWrite = fresult.canWrite("WEB_FINBOF");
|
||||
fresult.canGOEWrite = fresult.canWrite("WEB_FINGOE");
|
||||
|
||||
@@ -70,7 +70,6 @@ function fin_list (params)
|
||||
// Nieuw/versimpeld: fac_functie_min_level = 3 (lezen en schrijven)
|
||||
// Als ik vervanger ben van iemand met meer rechten dan krijg ik niet zijn rechten. Je blijft je eigen meldingen zien.
|
||||
var authparamsEXTFIN = user.checkAutorisation("WEB_EXTFIN", true);
|
||||
var authparamsFINUSE = user.checkAutorisation("WEB_FINUSE", true);
|
||||
var authparamsFINFOF = user.checkAutorisation("WEB_FINFOF", true);
|
||||
var authparamsFINBOF = user.checkAutorisation("WEB_FINBOF", true);
|
||||
var authparamsMLDFIN = user.checkAutorisation("WEB_MLDFIN", true);
|
||||
@@ -78,7 +77,6 @@ function fin_list (params)
|
||||
var authparamsFINGOE = user.checkAutorisation("WEB_FINGOE", true);
|
||||
|
||||
var canReadAnyFIN = (user.iamContact() && authparamsEXTFIN) ||
|
||||
authparamsFINUSE ||
|
||||
authparamsFINFOF ||
|
||||
authparamsFINBOF ||
|
||||
user.isBudgethouder();
|
||||
@@ -86,7 +84,7 @@ function fin_list (params)
|
||||
user.auth_required_or_abort(canReadAny);
|
||||
|
||||
// Ik ken 2 varianten: allemaal of alleen de mijne
|
||||
var alleenmijnkostenplaatsen = (!(user.iamContact() && authparamsEXTFIN) && !authparamsFINUSE && !authparamsFINFOF && !authparamsFINBOF && !authparamsMLDFIN); // geen EXTFIN + contactpers, FINUSE, FINFOF, FINBOF of MLDFIN -> budgethouder.
|
||||
var alleenmijnkostenplaatsen = (!(user.iamContact() && authparamsEXTFIN) && !authparamsFINFOF && !authparamsFINBOF && !authparamsMLDFIN); // geen EXTFIN + contactpers, FINFOF, FINBOF of MLDFIN -> budgethouder.
|
||||
|
||||
var asContactpersoon = user.iamContact() && authparamsEXTFIN && !authparamsFINFOF && !authparamsFINBOF;
|
||||
|
||||
@@ -858,7 +856,7 @@ function fin_list (params)
|
||||
// Gaat dat beide kanten op? Voorbeeld uit de MARX-hoek:
|
||||
// 1. als ik als woco inlog zie ik facturen van leveranciers waar ik zaken mee doe *van opdrachten van mijzelf*
|
||||
// 2. als ik als leverancier inlog zie ik facturen van mijzelf, maakt niet uit aan wie; dan hoeft het dus niet scherper.
|
||||
// Geldt dat eigenlijk niet altijd? Jawel, maar regel je 2 met FINUSE en 1 is vanzelfsprekend als je het enige bedrijf bent.
|
||||
// Geldt dat eigenlijk niet altijd? Jawel, maar regel je 2 met EXTFIN en 1 is vanzelfsprekend als je het enige bedrijf bent.
|
||||
// Is dan dus overbodig en best duur, dus liever vermijden.
|
||||
|
||||
// als ik de leverancier ben: mijn facturen; die route loopt via contactpersoon he.
|
||||
@@ -1093,7 +1091,7 @@ function fin_list (params)
|
||||
{
|
||||
buttons.push({ icon: "page_refresh.png", title: L("lcl_refresh"), action: "FcltMgr.reload()" });
|
||||
}
|
||||
if (!embedded && ((authparamsFINFOF && authparamsFINFOF.PRSwritelevel < 9) || (authparamsFINUSE && authparamsFINUSE.PRSwritelevel < 9)))
|
||||
if (!embedded && ((authparamsFINFOF && authparamsFINFOF.PRSwritelevel < 9) || (authparamsEXTFIN && authparamsEXTFIN.PRSwritelevel < 9)))
|
||||
{
|
||||
var addurl = "appl/fin/fin_factuur.asp?fin_key=-1";
|
||||
addurl += buildTransitParam(["cnt_key", "opdr_key", "bes_key"], params)
|
||||
|
||||
@@ -79,15 +79,14 @@ if (finstatus == -1 && finnum == "" && opdrnr == -1)
|
||||
|
||||
// Alleen PRSreadlevel en PRSwritelevel van belang want fac_functie_min_level = 7 (lezen en schrijven organisatie)
|
||||
var authparamsEXTFIN = user.checkAutorisation("WEB_EXTORD", true);
|
||||
var authparamsFINUSE = user.checkAutorisation("WEB_FINUSE", true);
|
||||
var authparamsFINFOF = user.checkAutorisation("WEB_FINFOF", true);
|
||||
var authparamsFINBOF = user.checkAutorisation("WEB_FINBOF", true);
|
||||
var authparamsMLDFIN = user.checkAutorisation("WEB_MLDFIN", true);
|
||||
|
||||
user.auth_required_or_abort((user.iamContact() && authparamsEXTFIN) || authparamsFINUSE || authparamsFINFOF || authparamsFINBOF || user.isBudgethouder());
|
||||
user.auth_required_or_abort((user.iamContact() && authparamsEXTFIN) || authparamsFINFOF || authparamsFINBOF || user.isBudgethouder());
|
||||
|
||||
// Ik ken 2 varianten: allemaal of alleen de mijne.
|
||||
var alleenmijnkostenplaatsen = (!(user.iamContact() && authparamsEXTFIN) && !authparamsFINUSE && !authparamsFINFOF && !authparamsFINBOF && !authparamsMLDFIN); // geen EXTFIN + contactpers, FINUSE, FINFOF, FINBOF of MLDFIN -> budgethouder.
|
||||
var alleenmijnkostenplaatsen = (!(user.iamContact() && authparamsEXTFIN) && !authparamsFINFOF && !authparamsFINBOF && !authparamsMLDFIN); // geen EXTFIN + contactpers, FINFOF, FINBOF of MLDFIN -> budgethouder.
|
||||
|
||||
// Fast check to see if we have more than one costcentregroup
|
||||
sql= "SELECT 1 FROM (SELECT COUNT (prs_kostenplaatsgrp_key) aantal FROM prs_kostenplaatsgrp) WHERE aantal > 1";
|
||||
|
||||
@@ -4379,7 +4379,6 @@ mld = {
|
||||
|
||||
// Factuur rechten
|
||||
var authparamsEXTFIN = user.checkAutorisation("WEB_EXTFIN", true);
|
||||
var authparamsFINUSE = user.checkAutorisation("WEB_FINUSE", true);
|
||||
var authparamsFINFOF = user.checkAutorisation("WEB_FINFOF", true);
|
||||
var authparamsFINBOF = user.checkAutorisation("WEB_FINBOF", true);
|
||||
var authparamsMLDFIN = user.checkAutorisation("WEB_MLDFIN", true);
|
||||
@@ -4387,11 +4386,9 @@ mld = {
|
||||
// Alleen FE (als contactpersoon) of FO kan aanmaken.
|
||||
mresult.canAddFactuur = typehas_cost && !has_facturen &&
|
||||
((mresult.iamBedrijfContact && authparamsEXTFIN && authparamsEXTFIN.PRSwritelevel < 9) ||
|
||||
(authparamsFINUSE && authparamsFINUSE.PRSwritelevel < 9) ||
|
||||
(authparamsFINFOF && authparamsFINFOF.PRSwritelevel < 9)); // Kan rechtstreeks vanuit opdrachten een factuur aanmaken.
|
||||
mresult.canListFactuur = typehas_cost && has_facturen &&
|
||||
((mresult.iamBedrijfContact && authparamsEXTFIN) ||
|
||||
authparamsFINUSE ||
|
||||
authparamsFINFOF ||
|
||||
authparamsFINBOF ||
|
||||
user.isBudgethouder() ||
|
||||
|
||||
@@ -323,15 +323,12 @@ function opdr_list(params)
|
||||
// Factuur rechten.
|
||||
var authparamsEXTORD = user.checkAutorisation("WEB_EXTORD", true);
|
||||
var authparamsEXTFIN = user.checkAutorisation("WEB_EXTFIN", true);
|
||||
var authparamsFINUSE = user.checkAutorisation("WEB_FINUSE", true);
|
||||
var authparamsFINFOF = user.checkAutorisation("WEB_FINFOF", true);
|
||||
var authparamsFINBOF = user.checkAutorisation("WEB_FINBOF", true);
|
||||
var authparamsMLDFIN = user.checkAutorisation("WEB_MLDFIN", true);
|
||||
// Alleen ALGreadlevel en ALGwritelevel van belang want fac_functie_min_level = 3 (lezen en schrijven plaats)
|
||||
var hasAddFactuurRightsFINUSE = (authparamsFINUSE && authparamsFINUSE.ALGwritelevel < 9);
|
||||
var hasAddFactuurRightsFINFOF = (authparamsFINFOF && authparamsFINFOF.ALGwritelevel < 9);
|
||||
var hasListFactuurRights = ((user.iamContact() && authparamsEXTFIN) ||
|
||||
authparamsFINUSE ||
|
||||
authparamsFINFOF ||
|
||||
authparamsFINBOF ||
|
||||
user.isBudgethouder() ||
|
||||
@@ -401,12 +398,10 @@ function opdr_list(params)
|
||||
// Kan rechtstreeks vanuit deze opdracht een factuur aanmaken.
|
||||
var eAddFactuur = typehas_cost && !has_facturen &&
|
||||
((iamBedrijfContact && authparamsEXTFIN && authparamsEXTFIN.ALGwritelevel < 9) ||
|
||||
hasAddFactuurRightsFINUSE ||
|
||||
hasAddFactuurRightsFINFOF);
|
||||
// Mag lijst met facturen zien die bij deze opdracht horen.
|
||||
var eListFactuur = typehas_cost && has_facturen &&
|
||||
((iamBedrijfContact && authparamsEXTFIN) ||
|
||||
authparamsFINUSE ||
|
||||
authparamsFINFOF ||
|
||||
authparamsFINBOF ||
|
||||
user.isBudgethouder() ||
|
||||
|
||||
@@ -25,13 +25,11 @@
|
||||
// Geen autfunction bepaald. Je komt bij FIN niet binnen met een bepaalde rol (urole).
|
||||
// Nieuw/versimpeld: fac_functie_min_level = 3 (lezen en schrijven)
|
||||
var authparamsEXTFIN = user.checkAutorisation("WEB_EXTFIN", true);
|
||||
var authparamsFINUSE = user.checkAutorisation("WEB_FINUSE", true);
|
||||
var authparamsFINFOF = user.checkAutorisation("WEB_FINFOF", true);
|
||||
var authparamsFINBOF = user.checkAutorisation("WEB_FINBOF", true);
|
||||
var authparamsMLDFIN = user.checkAutorisation("WEB_MLDFIN", true);
|
||||
|
||||
var canReadAnyFIN = (user.iamContact() && authparamsEXTFIN) ||
|
||||
authparamsFINUSE ||
|
||||
authparamsFINFOF ||
|
||||
authparamsFINBOF ||
|
||||
user.isBudgethouder();
|
||||
|
||||
@@ -143,8 +143,8 @@ function bedrijf_list (pautfunction, params)
|
||||
var authparamsRELUSE = user.checkAutorisation("WEB_RELUSE", true);
|
||||
var authparamsBGTUSE = S("bgt_enabled") == 1 && user.checkAutorisation("WEB_BGTUSE", true);
|
||||
|
||||
var asContactpersoon = user.iamContact() && authparamsEXTREL && !authparamsRELMAN && !authparamsRELUSE && !authparamsPRSMAN && !authparamsBGTUSE;
|
||||
if (asContactpersoon) // een stukje autorisatie, als ik contactpersoon ben dan moet ik het ook van dit bedrijf zijn
|
||||
var asContactpersoon = authparamsEXTREL && !authparamsRELMAN && !authparamsRELUSE && !authparamsPRSMAN && !authparamsBGTUSE;
|
||||
if (asContactpersoon) // een stukje autorisatie, als ik contactpersoon ben dan moet ik het ook van dit bedrijf zijn.
|
||||
sql += " AND b.prs_bedrijf_key IN"
|
||||
+ " (SELECT prs_bedrijf_key"
|
||||
+ " FROM prs_contactpersoon"
|
||||
|
||||
Reference in New Issue
Block a user