summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-17 22:00:33 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-17 22:00:33 -0700
commit804b696bdc7d0b68701ce80e6ff5fba7ff3677c3 (patch)
tree7ba0acb7505b32800e9d1bfab66b5fe62c42beb3 /web/react/utils
parent44714dfcb18b9a393dc34be3c182b0c092eec28a (diff)
downloadchat-804b696bdc7d0b68701ce80e6ff5fba7ff3677c3.tar.gz
chat-804b696bdc7d0b68701ce80e6ff5fba7ff3677c3.tar.bz2
chat-804b696bdc7d0b68701ce80e6ff5fba7ff3677c3.zip
PLT-11 adding config for logs to UI
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/utils.jsx23
1 files changed, 23 insertions, 0 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 032cf4ff4..074591489 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -54,6 +54,29 @@ export function isTestDomain() {
return false;
}
+export function isInRole(roles, inRole) {
+ var parts = roles.split(' ');
+ for (var i = 0; i < parts.length; i++) {
+ if (parts[i] === inRole) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+export function isAdmin(roles) {
+ if (isInRole(roles, 'admin')) {
+ return true;
+ }
+
+ if (isInRole(roles, 'system_admin')) {
+ return true;
+ }
+
+ return false;
+}
+
export function getDomainWithOutSub() {
var parts = window.location.host.split('.');