Skip to content

Commit

Permalink
VO members can re-sign the AUP at any time (#757)
Browse files Browse the repository at this point in the history
* Add suspended label next to client name
* Add API and service methods to change client status
* Make client suspension details available to client owner
* Add AUP re-sign button
* Make re-sign visible only to respective user
  • Loading branch information
garaimanoj committed May 29, 2024
1 parent a71b803 commit eac5eb3
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<script type="text/javascript" src="${resourcesPrefix}/iam/apps/dashboard-app/components/tokens/tokens.component.js"></script>

<script type="text/javascript" src="${resourcesPrefix}/iam/apps/dashboard-app/components/aup/aup.component.js"></script>
<script type="text/javascript" src="${resourcesPrefix}/iam/apps/dashboard-app/components/aup/aup.resign.component.js"></script>

<script type="text/javascript" src="${resourcesPrefix}/iam/apps/dashboard-app/components/group/group.description.component.js"></script>
<script type="text/javascript" src="${resourcesPrefix}/iam/apps/dashboard-app/components/group/group.component.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<button ng-if="$ctrl.user.aupSignature"
class="btn btn-success btn-block"
style="margin-top: 5px"
ng-click="$ctrl.openSignAUPModal()"
name="sign-aup-btn" ng-if="$ctrl.isMe()">
<i class="fa fa-file-text-o"></i>
<strong>Re-sign AUP</strong>
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

(function () {
'use strict';

function ResignModalController($scope, $uibModalInstance, toaster, AupService, user) {
var self = this;
self.enabled = true;
self.user = user;

self.cancel = function() {
$uibModalInstance.close('Cancelled');
};

self.submit = function() {
self.error = undefined;
self.enabled = false;
AupService.resignAup()
.then(function(res) {
$uibModalInstance.close('AUP signature re-signed succesfully');
self.enabled = true;
}, function(res) {
self.error = res.data.error;
self.enabled = true;
toaster.pop({ type: 'error', body: self.error});
});
};
}

function AupResignController($scope, $uibModal, toaster) {
var self = this;
self.enabled = true;

self.isMe = function () {
return self.userCtrl.isMe();
};

self.openSignAUPModal = function() {
var modalInstance = $uibModal.open({
templateUrl: '/resources/iam/apps/dashboard-app/templates/home/resignAup.html',
controller: ResignModalController,
controllerAs: 'resignModalCtrl',
resolve: {user: function() { return self.user; }}
});

modalInstance.result.then(function(msg) {
toaster.pop({type: 'success', body: msg});
}, function () {
console.log('Re-sign AUP modal dismissed at: ' + new Date());
});
};
}


angular.module('dashboardApp').component('aupResign', {
templateUrl: '/resources/iam/apps/dashboard-app/components/aup/aup.resign.component.html',
bindings: {
user: '<'
},
controller: [
'$rootScope', '$uibModal', 'toaster', 'AupService', AupResignController
]
});
})();
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h1>

<!-- Send reset password email or change password-->
<user-password user="$ctrl.user"></user-password>

<aup-resign user="$ctrl.user" ng-if="$ctrl.isMe()"></aup-resign>
</div>
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
touchAup: touchAup,
deleteAup: deleteAup,
getAupSignature: getAupSignature,
getAupSignatureForUser: getAupSignatureForUser
getAupSignatureForUser: getAupSignatureForUser,
resignAup: resignAup
};

return service;
Expand Down Expand Up @@ -80,5 +81,15 @@
return $q.reject(res);
});
}

function resignAup() {
return $http.post('/iam/aup/signature/').catch(function(res) {
if (res.status == 404) {
console.info("Account not found");
return null;
}
return $q.reject(res);
});
}
}
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="modal-header">
<h3 class="modal-title">
Re-sign Acceptable Usage Policy
</h3>
</div>
<div class="modal-body">
<div ng-if="resignModalCtrl.user.aupSignature.aup.text != null">
<p id="sign-aup-subtitle">In order to proceed, you need to sign the Acceptable Usage Policy (AUP) for this
organization:</p>
<div class="form-group">
<div class="aup-text">{{ resignModalCtrl.user.aupSignature.aup.text }}</div>
</div>
</div>
<div ng-if="resignModalCtrl.user.aupSignature.aup.url != null">
<p id="sign-aup-subtitle">
In order to proceed, you need to declare that you have read and that you accept the terms of this organization
<a href="{{ resignModalCtrl.user.aupSignature.aup.url }}" target="_blank" rel="noopener noreferrer">Acceptable Usage Policy (AUP).</a>
</p>
</div>
<div class="form-group sign-aup-btns">
<button id="sign-aup-btn" class="btn btn-success" type="button" ng-click="resignModalCtrl.submit()">I agree with the AUP terms</button>
<button id="sign-aup-btn-cancel" class="btn btn-danger" type="button" ng-click="resignModalCtrl.cancel()">Cancel</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,5 @@ public void updateAupWithRightScope() throws Exception {
.andExpect(jsonPath("$.error", equalTo("Account not found for id: 1234")));

}

}

0 comments on commit eac5eb3

Please sign in to comment.