This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 63f8670319929ae9dae7ea3d590454984158f3aa Author: Kevin Morin <morin@codelutin.com> Date: Tue Sep 19 14:48:42 2017 +0200 verification du statut admin avant d'accéder aux tiers de connexion --- pollen-ui-riot-js/src/main/web/js/Session.js | 4 ++++ pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/js/Session.js b/pollen-ui-riot-js/src/main/web/js/Session.js index ad891a7d..3524ec10 100644 --- a/pollen-ui-riot-js/src/main/web/js/Session.js +++ b/pollen-ui-riot-js/src/main/web/js/Session.js @@ -127,6 +127,10 @@ class Session { return document.cookie.indexOf("pollen-connected=true") !== -1; } + isAdminConnected() { + return this.isConnected() && this.getUser().administrator; + } + connect() { logger.info("Connect::"); return authService.connectedUserPromise().then((user) => { diff --git a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html index 9268f164..cf0c4fc5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html @@ -141,7 +141,7 @@ require("./popup/GtuChangeModal.tag.html"); }); route("/poll", () => { - if (!session.isConnected() && !session.getUser().administrator) { + if (!session.isAdminConnected()) { route("/signin?url=/poll"); } else { this.bus.trigger("pageChanged", "admin_polls"); @@ -150,7 +150,7 @@ require("./popup/GtuChangeModal.tag.html"); }); route("/user", () => { - if (!session.isConnected() && !session.getUser().administrator) { + if (!session.isAdminConnected()) { route("/signin?url=/user"); } else { this.bus.trigger("pageChanged", "admin_users"); @@ -159,8 +159,8 @@ require("./popup/GtuChangeModal.tag.html"); }); route("/gtu", () => { - if (!session.isConnected() && !session.getUser().administrator) { - route("/signin?url=/gtu"); + if (!session.isAdminConnected()) { + route("/signin?url=/user"); } else { this.bus.trigger("pageChanged", "admin_gtus"); riot.mount(this.refs.content, "gtus", {session: session}); @@ -241,8 +241,12 @@ require("./popup/GtuChangeModal.tag.html"); }); route("/loginProviders", () => { - this.bus.trigger("pageChanged", "loginProviders"); - riot.mount(this.refs.content, "loginproviders"); + if (!session.isAdminConnected()) { + route("/signin?url=/loginProviders"); + } else { + this.bus.trigger("pageChanged", "loginProviders"); + riot.mount(this.refs.content, "loginproviders"); + } }); route("/privacy", () => { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.