Skip to content

Commit

Permalink
Add reason for not displaying _Root webhooks for non-admin users in
Browse files Browse the repository at this point in the history
Webhooks Project Tab. Fixes issue #11.
Removed buildWebHookTab.jsp as it was no longer used.
Renamed projectWebHookTab.jsp webHookTab.jsp since it is now used for
Build and Project tab pages.
  • Loading branch information
netwolfuk committed Oct 31, 2015
1 parent 95a3d25 commit 332d7a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ protected void fillModel(Map model, HttpServletRequest request,

@Override
public String getIncludeUrl() {
//return myPluginPath + "WebHook/buildWebHookTab.jsp";
return myPluginPath + "WebHook/projectWebHookTab.jsp";
return myPluginPath + "WebHook/webHookTab.jsp";
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ protected void fillModel(Map model, HttpServletRequest request,

List<ProjectAndBuildWebhooksBean> projectAndParents = new ArrayList<ProjectAndBuildWebhooksBean>();
List<SProject> parentProjects = project.getProjectPath();

model.put("permissionError", "");

if (!user.getGlobalPermissions().contains(Permission.CHANGE_SERVER_SETTINGS)){
parentProjects.remove(0);
if (project.getProjectId().equals("_Root")){
model.put("permissionError", "<strong>You do not have permission to view WebHooks for the <em>_Root</em> project. Please contact your TeamCity Administrator</strong>");
}
}
for (SProject projectParent : parentProjects){
projectAndParents.add(
Expand All @@ -73,6 +79,8 @@ protected void fillModel(Map model, HttpServletRequest request,

model.put("projectAndParents", projectAndParents);



// model.put("projectWebHookCount", projectWebhooks.size());
// if (projectWebhooks.size() == 0){
// model.put("noProjectWebHooks", "true");
Expand All @@ -93,7 +101,7 @@ protected void fillModel(Map model, HttpServletRequest request,

@Override
public String getIncludeUrl() {
return myPluginPath+ "WebHook/projectWebHookTab.jsp";
return myPluginPath+ "WebHook/webHookTab.jsp";
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%@ include file="/include.jsp" %>
<div>

${permissionError}

<c:forEach items="${projectAndParents}" var="project">
<div style="background-color: #f5f5f5; padding: 5px; margin:0.75em; margin-top:3em;">
<c:choose>
Expand Down Expand Up @@ -39,7 +41,7 @@

<c:forEach items="${project.buildWebhooks}" var="config">

<div style='margin-top: 2.5em;'><h3 class="title">WebHooks configured for ${projectName} &gt; ${config.buildName}</h3>
<div style='margin-top: 2.5em;'><h3 class="title" style="background-color: #f5f5f5; border-bottom: solid 2px #ABB1C4;">WebHooks configured for ${projectName} &gt; ${config.buildName}</h3>

<c:if test="${config.hasNoBuildWebHooks}" >
<div style='margin-left: 1em; margin-right:1em;'>
Expand Down

0 comments on commit 332d7a5

Please sign in to comment.