0)
- outstandingReqs = outstanding+"";
-
- if (authority.equals("ROLE_USER") || authority.equals("ROLE_ADMIN") || authority.equals("ROLE_SUPERUSER")) {
- statusAuth = "Authorized";
- } else {
- statusAuth = "NotAuthorized";
- }
-
- if (authority.equals("ROLE_ADMIN") || authority.equals("ROLE_SUPERUSER"))
- statusAuthExecTopics = "Authorized";
- else
- statusAuthExecTopics = "NotAuthorized";
-
- return "{ \"status\": \"" + statusAuth + "\" ," +
- " \"username\":\"" + userDetails.getUsername() + "\"," +
- " \"teamname\": \"" + teamName + "\"," +
- " \"companyinfo\": \"" + companyInfo + "\"," +
- " \"notifications\": \"" + outstandingReqs + "\"," +
- " \"statusauthexectopics\": \"" + statusAuthExecTopics + "\" }";
+ String teamName = createTopicHelper.getUsersInfo(userDetails.getUsername()).getTeam();
+ GrantedAuthority ga = userDetails.getAuthorities().iterator().next();
+ String authority = ga.getAuthority();
+
+ //LOG.info("auth is " + authority);
+ String statusAuth = null;
+ String statusAuthExecTopics = null;
+ String licenseValidity=null;
+
+ int outstanding = createTopicHelper.getAllRequestsToBeApproved(userDetails.getUsername());
+ String outstandingReqs = "";
+ if(outstanding>0)
+ outstandingReqs = outstanding+"";
+
+ if (authority.equals("ROLE_USER") || authority.equals("ROLE_ADMIN") || authority.equals("ROLE_SUPERUSER")) {
+ statusAuth = "Authorized";
+ } else {
+ statusAuth = "NotAuthorized";
+ }
+
+ if (authority.equals("ROLE_ADMIN") || authority.equals("ROLE_SUPERUSER"))
+ statusAuthExecTopics = "Authorized";
+ else
+ statusAuthExecTopics = "NotAuthorized";
+
+ return "{ \"status\": \"" + statusAuth + "\" ," +
+ " \"username\":\"" + userDetails.getUsername() + "\"," +
+ " \"teamname\": \"" + teamName + "\"," +
+ " \"companyinfo\": \"" + companyInfo + "\"," +
+ " \"notifications\": \"" + outstandingReqs + "\"," +
+ " \"statusauthexectopics\": \"" + statusAuthExecTopics + "\" }";
}
else return null;
}
diff --git a/kafkawize-web/src/main/java/com/kafkamgt/uiapi/service/UtilService.java b/kafkawize-web/src/main/java/com/kafkamgt/uiapi/service/UtilService.java
new file mode 100644
index 0000000..e11a632
--- /dev/null
+++ b/kafkawize-web/src/main/java/com/kafkamgt/uiapi/service/UtilService.java
@@ -0,0 +1,29 @@
+package com.kafkamgt.uiapi.service;
+
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UtilService {
+ public boolean checkAuthorizedSU(){
+ UserDetails userDetails = getUserDetails();
+
+ GrantedAuthority ga = userDetails.getAuthorities().iterator().next();
+ String authority = ga.getAuthority();
+ if(!authority.equals("ROLE_SUPERUSER"))
+ return false;
+ else
+ return true;
+ }
+
+ public String getUserName(){
+ UserDetails userDetails = (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+ return userDetails.getUsername();
+ }
+
+ public UserDetails getUserDetails(){
+ return (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+ }
+}
diff --git a/kafkawize-web/src/main/resources/static/js/createTopic.js b/kafkawize-web/src/main/resources/static/js/createTopic.js
deleted file mode 100644
index d652a98..0000000
--- a/kafkawize-web/src/main/resources/static/js/createTopic.js
+++ /dev/null
@@ -1,110 +0,0 @@
-'use strict'
-
-// confirmation of delete
-// edit
-// solution for transaction
-// message store / key / gui
-var app = angular.module('createTopicApp',[]);
-
-app.controller("createTopicCtrl", function($scope, $http, $location, $window) {
-
- // Set http service defaults
- // We force the "Accept" header to be only "application/json"
- // otherwise we risk the Accept header being set by default to:
- // "application/json; text/plain" and this can result in us
- // getting a "text/plain" response which is not able to be
- // parsed.
- $http.defaults.headers.common['Accept'] = 'application/json';
-
-
- $scope.partitions = [ { label: '1', value: '1' }, { label: '2', value: '2' },
- { label: '3', value: '3' }, { label: '4', value: '4' }, { label: '5', value: '5' }, { label: '6', value: '6' },
- { label: '7', value: '7' }, { label: '8', value: '8' } ];
-
- $scope.replications = [ { label: '1', value: '1' }, { label: '2', value: '2' },
- { label: '3', value: '3' }, { label: '4', value: '4' } ];
-
- // We add the "time" query parameter to prevent IE
- // from caching ajax results
-
- $scope.getAuth = function() {
- $http({
- method: "GET",
- url: "getAuth",
- headers : { 'Content-Type' : 'application/json' }
- }).success(function(output) {
- $scope.statusauth = output.status;
- $scope.userlogged = output.username;
- $scope.teamname = output.teamname;
- $scope.notifications = output.notifications;
- $scope.statusauthexectopics = output.statusauthexectopics;
- $scope.alerttop = output.alertmessage;
- if(output.companyinfo == null){
- $scope.companyinfo = "Company not defined!!";
- }
- else
- $scope.companyinfo = output.companyinfo;
-
- if($scope.userlogged != null)
- $scope.loggedinuser = "true";
- }).error(
- function(error)
- {
- $scope.alert = error;
- }
- );
- }
-
- $scope.logout = function() {
- $http({
- method: "GET",
- url: "logout"
- }).success(function(output) {
-
- $location.path('/');
- $window.location.reload();
- }).error(
- function(error)
- {
- $scope.alert = error;
- }
- );
- }
-
- $scope.addTopic = function() {
-
- var serviceInput = {};
-
- serviceInput['clusterType'] = $scope.addTopic.clusterType.value;
- serviceInput['environment'] = $scope.addTopic.envName.name;
- serviceInput['topicName'] = $scope.addTopic.topicName;
- serviceInput['partitions'] = $scope.addTopic.partitions.value;
- serviceInput['replications'] = $scope.addTopic.replications.value;
-
- if (!window.confirm("Are you sure, you would like to create the topic : "+ $scope.addTopic.topicName + "\nCluster : " +
- $scope.addTopic.clusterType.label + "\nEnv : " + $scope.addTopic.envName.name + "\nParitions : " + $scope.addTopic.partitions.value +
- "\nReplications : "+ $scope.addTopic.replications.value + " ?")) {
- return;
- }
-
- $http({
- method: "POST",
- url: "eventbusweb/createtopic",
- headers : { 'Content-Type' : 'application/json' },
- params: {'addTopicRequest' : serviceInput },
- data: {'addTopicRequest' : serviceInput}
- }).success(function(output) {
- $scope.resultAdd = output;
- $scope.alert = "Topic addition : "+output.result;
- }).error(
- function(error)
- {
- $scope.alert = error;
- alert("Error : "+error);
- }
- );
-
- };
-
-}
-);
\ No newline at end of file
diff --git a/kafkawize-web/src/main/resources/static/js/manageUsers.js b/kafkawize-web/src/main/resources/static/js/manageUsers.js
index b8538f2..3c89279 100644
--- a/kafkawize-web/src/main/resources/static/js/manageUsers.js
+++ b/kafkawize-web/src/main/resources/static/js/manageUsers.js
@@ -99,6 +99,33 @@ app.controller("manageUsersCtrl", function($scope, $http, $location, $window) {
};
+ $scope.deleteTeam = function(){
+
+ if (!window.confirm("Are you sure, you would like to delete the team : "
+ + $scope.deleteTeam.idval
+ )) {
+ return;
+ }
+
+ $http({
+ method: "POST",
+ url: "deleteTeamRequest",
+ headers : { 'Content-Type' : 'application/json' },
+ params: {'teamId' : $scope.deleteTeam.idval },
+ data: {'teamId' : $scope.deleteTeam.idval}
+ }).success(function(output) {
+
+ $scope.alert = "Delete Team Request : "+output.result;
+ $scope.loadTeamsSU();
+
+ }).error(
+ function(error)
+ {
+ $scope.alert = error;
+ }
+ );
+ }
+
$scope.deleteUser = function(){
if (!window.confirm("Are you sure, you would like to delete the user : "
diff --git a/kafkawize-web/src/main/resources/static/js/requestTopics.js b/kafkawize-web/src/main/resources/static/js/requestTopics.js
index b665d25..92bfa25 100644
--- a/kafkawize-web/src/main/resources/static/js/requestTopics.js
+++ b/kafkawize-web/src/main/resources/static/js/requestTopics.js
@@ -24,13 +24,19 @@ app.controller("requestTopicsCtrl", function($scope, $http, $location, $window)
alert("Please fill in topic partitions");
return;
}
- if(($scope.addTopic.acl_ip !=null && $scope.addTopic.acl_ip.length>0) ||
- ($scope.addTopic.acl_ssl !=null && $scope.addTopic.acl_ssl.length>0)){}
- else
- {
- alert("Please fill in a valid IP address or SSL-CN Name of the Producer client");
+
+ if(isNaN($scope.addTopic.topicpartitions)){
+ alert("Please fill in a valid number for partitions for topic");
return;
- }
+ }
+
+// if(($scope.addTopic.acl_ip !=null && $scope.addTopic.acl_ip.length>0) ||
+// ($scope.addTopic.acl_ssl !=null && $scope.addTopic.acl_ssl.length>0)){}
+// else
+// {
+// alert("Please fill in a valid IP address or SSL-CN Name of the Producer client");
+// return;
+// }
if(!$scope.addTopic.team)
{
@@ -44,16 +50,13 @@ app.controller("requestTopicsCtrl", function($scope, $http, $location, $window)
serviceInput['teamname'] = $scope.addTopic.team.teamname;
serviceInput['appname'] = $scope.addTopic.app;
serviceInput['remarks'] = $scope.addTopic.remarks;
- serviceInput['acl_ip'] = $scope.addTopic.acl_ip;
- serviceInput['acl_ssl'] = $scope.addTopic.acl_ssl;
- if (!window.confirm("Are you sure, you would like to request the topic : "
- + $scope.addTopic.topicname +
+ if (!window.confirm("Are you sure, you would like to request a topic ?"+
+ "\nTopic : " + $scope.addTopic.topicname +
"\nPartitions : " + $scope.addTopic.topicpartitions +
"\nEnv : " + $scope.addTopic.envName.name +
- "\nTeam :" + $scope.addTopic.team.teamname +
- "\nApp :" + $scope.addTopic.app +
- "\nAcl :" + $scope.addTopic.acl_ip +" \nAcl SSL:"+ $scope.addTopic.acl_ssl
+ "\nTeam : " + $scope.addTopic.team.teamname +
+ "\nApp : " + $scope.addTopic.app
)) {
return;
}
@@ -76,6 +79,7 @@ app.controller("requestTopicsCtrl", function($scope, $http, $location, $window)
};
+
$scope.getEnvs = function() {
$http({
diff --git a/kafkawize-web/src/main/resources/templates/execTopics.html b/kafkawize-web/src/main/resources/templates/execTopics.html
index 533ea2e..b832119 100644
--- a/kafkawize-web/src/main/resources/templates/execTopics.html
+++ b/kafkawize-web/src/main/resources/templates/execTopics.html
@@ -376,8 +376,8 @@ Approve Topics
Replication Factor |
Cluster |
Requestor |
- Acl IP(Producer) |
- Acl SSL |
+
+
Team |
@@ -394,8 +394,8 @@ Approve Topics
{{ topicRequest.replicationfactor }} |
{{ topicRequest.environment }} |
{{ topicRequest.username }} |
- {{ topicRequest.acl_ip }} |
- {{ topicRequest.acl_ssl }} |
+
+
{{ topicRequest.teamname }} |
diff --git a/kafkawize-web/src/main/resources/templates/pcTopics.html b/kafkawize-web/src/main/resources/templates/pcTopics.html
index db910e2..357962d 100644
--- a/kafkawize-web/src/main/resources/templates/pcTopics.html
+++ b/kafkawize-web/src/main/resources/templates/pcTopics.html
@@ -389,7 +389,7 @@ Producers & Consumers
Topic |
- Producer Teams |
+ Producer/Owner Teams |
Consumer Teams |
diff --git a/kafkawize-web/src/main/resources/templates/requestAcls.html b/kafkawize-web/src/main/resources/templates/requestAcls.html
index 45a3bc7..336930f 100644
--- a/kafkawize-web/src/main/resources/templates/requestAcls.html
+++ b/kafkawize-web/src/main/resources/templates/requestAcls.html
@@ -410,7 +410,7 @@ ACL (Access Control List) Request Form