From a5882736d04136721b940203daa2a59ae81b5ae8 Mon Sep 17 00:00:00 2001 From: Leonardo Matos Date: Thu, 22 Aug 2019 21:11:19 -0300 Subject: [PATCH] feat(is-verified): method to check last authorization level --- src/methods/is-authorized.js | 2 +- src/methods/is-verified.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 src/methods/is-verified.js diff --git a/src/methods/is-authorized.js b/src/methods/is-authorized.js index 2a9618a..a39148e 100644 --- a/src/methods/is-authorized.js +++ b/src/methods/is-authorized.js @@ -1,3 +1,3 @@ // it does not validate authentication token // only checks session auth level -export default self => self.session.auth && self.session.auth.level >= 2 +export default self => Boolean(self.session.auth && self.session.auth.level >= 2) diff --git a/src/methods/is-verified.js b/src/methods/is-verified.js new file mode 100644 index 0000000..b0f631e --- /dev/null +++ b/src/methods/is-verified.js @@ -0,0 +1,4 @@ +// it does not validate authentication token +// only checks session auth level +// last authorization level +export default self => Boolean(self.session.auth && self.session.auth.level >= 3)