From 804b696bdc7d0b68701ce80e6ff5fba7ff3677c3 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 17 Sep 2015 22:00:33 -0700 Subject: PLT-11 adding config for logs to UI --- web/react/utils/utils.jsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'web/react/utils') 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('.'); -- cgit v1.2.3-1-g7c22