2019-09-12 21:44:31 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the authRXBN single sign-on package.
|
|
|
|
*
|
|
|
|
* (c) Ruben Meyer <contact@rxbn.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* EXPLANATIONS:
|
2019-09-25 18:22:25 +00:00
|
|
|
*
|
2019-09-12 21:44:31 +00:00
|
|
|
* groups: ["anon", "user", "admin"]
|
|
|
|
* - anon: not logged in; no cookies
|
|
|
|
* - user: logged in; non-special group
|
|
|
|
* - admin: logged in; admin group 999 or equivalent
|
2019-09-25 18:22:25 +00:00
|
|
|
*
|
|
|
|
* expressions: RegExp tested on req.path
|
|
|
|
* - ex.:
|
|
|
|
* - req.path = "/profile/456";
|
|
|
|
* - expression = "(/profile/.*)";
|
|
|
|
* - (new RegExp(expression, "g")).test(req.path) ~> true
|
|
|
|
*
|
|
|
|
* rules: rules which can be rolled out
|
|
|
|
* - block: block direct access
|
|
|
|
*
|
|
|
|
* types: ["404", "missing_permission"]
|
|
|
|
* - 404: File not found
|
|
|
|
* - missing_permission: Missing Permission page
|
|
|
|
* - login: login page
|
2019-09-12 21:44:31 +00:00
|
|
|
*/
|
|
|
|
let rules = [
|
|
|
|
{
|
|
|
|
group: "anon",
|
|
|
|
expression: "(/blocks/.*)",
|
|
|
|
rule: "block",
|
|
|
|
type: "404"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
group: "anon",
|
|
|
|
expression: "(/error/.*)",
|
|
|
|
rule: "block",
|
|
|
|
type: "404"
|
|
|
|
},
|
2019-09-25 18:22:25 +00:00
|
|
|
{
|
|
|
|
group: "anon",
|
|
|
|
expression: "(/admin/.*)",
|
|
|
|
rule: "block",
|
|
|
|
type: "login"
|
|
|
|
},
|
2019-09-12 21:44:31 +00:00
|
|
|
{
|
|
|
|
group: "user",
|
|
|
|
expression: "(/blocks/.*)",
|
|
|
|
rule: "block",
|
|
|
|
type: "404"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
group: "user",
|
|
|
|
expression: "(/error/.*)",
|
|
|
|
rule: "block",
|
|
|
|
type: "404"
|
2019-09-25 18:22:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
group: "user",
|
|
|
|
expression: "(/admin/.*)",
|
|
|
|
rule: "block",
|
|
|
|
type: "missing_permission"
|
2019-09-12 21:44:31 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
module.exports = rules;
|