admin: manage team certificate from interface
This commit is contained in:
parent
3a27e1095c
commit
f26cb4ef4f
2 changed files with 78 additions and 13 deletions
|
|
@ -546,10 +546,47 @@ angular.module("FICApp")
|
|||
}
|
||||
}
|
||||
})
|
||||
.controller("TeamController", function($scope, $location, Team, TeamMember, $routeParams) {
|
||||
.controller("TeamController", function($scope, $location, Team, TeamMember, $routeParams, $http) {
|
||||
$scope.team = Team.get({ teamId: $routeParams.teamId });
|
||||
$scope.fields = ["name", "color"];
|
||||
|
||||
$scope.hasCertificate = false;
|
||||
$http({
|
||||
url: "/api/teams/" + Math.floor($routeParams.teamId) + "/certificate.p12",
|
||||
method: "HEAD",
|
||||
transformResponse: null
|
||||
}).then(function(response) {
|
||||
$scope.hasCertificate = true;
|
||||
}, function(response) {
|
||||
$scope.hasCertificate = false;
|
||||
});
|
||||
|
||||
$scope.generateCertificate = function() {
|
||||
$http({
|
||||
url: "/api/teams/" + Math.floor($routeParams.teamId) + "/certificate/generate",
|
||||
method: "GET",
|
||||
transformResponse: null
|
||||
}).then(function(response) {
|
||||
$scope.hasCertificate = true;
|
||||
}, function(response) {
|
||||
console.log(response.data);
|
||||
});
|
||||
}
|
||||
$scope.revokeCertificate = function() {
|
||||
if (!confirm("Are you sure you want to revoke this certificate?"))
|
||||
return false;
|
||||
|
||||
$http({
|
||||
url: "/api/teams/" + Math.floor($routeParams.teamId) + "/certificate.p12",
|
||||
method: "DELETE",
|
||||
transformResponse: null
|
||||
}).then(function(response) {
|
||||
$scope.hasCertificate = false;
|
||||
}, function(response) {
|
||||
console.log(response.data);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.saveTeam = function() {
|
||||
if (this.team.id) {
|
||||
this.team.$update();
|
||||
|
|
|
|||
Reference in a new issue