Extended test current group member test function to handle more groups to test
Change-Id: I55b0ba0afd2d6eb09381bfa7f94df96a1b65e507
diff --git a/src/com/mirantis/mk/JenkinsUtils.groovy b/src/com/mirantis/mk/JenkinsUtils.groovy
index 43be87b..b99ac2a 100644
--- a/src/com/mirantis/mk/JenkinsUtils.groovy
+++ b/src/com/mirantis/mk/JenkinsUtils.groovy
@@ -13,11 +13,19 @@
* @return boolean result
*/
def currentUserInGroup(groupName){
+ return currentUserInGroups([groupName])
+}
+/**
+ * Tests if current user belongs to at least one of given groups
+ * @param groups list of group names you want to verify user presence
+ * @return boolean result
+ */
+def currentUserInGroups(groups){
def hasAccess = false
wrap([$class: 'BuildUser']) {
def authorities = Jenkins.instance.securityRealm.loadUserByUsername(BUILD_USER).getAuthorities()
for(int i=0;i < authorities.size();i++){
- if(authorities[i].equals(groupName)){
+ if(groups.contains(authorities[i])){
hasAccess=true
break
}