Unverified Commit 5a7372fc authored by Jerome Boucher's avatar Jerome Boucher
Browse files

fix(#13847) : remove route from app

parent 8d312fa3
Pipeline #8186 failed with stage
......@@ -123,6 +123,26 @@ class userAccount
}
$userAccounts = $this->sdoFactory->find('auth/account', \laabs\implode(" AND ", $queryAssert));
return $this->removeSensibleData($userAccounts);
}
/**
* Remove sensible data from an array of users
*
* @param array $userAccounts Array of user Accounts
*
* @return array Array of userAccounts removed of sensible data
*/
protected function removeSensibleData($userAccounts)
{
foreach ($userAccounts as $key => $user) {
unset($userAccounts[$key]->password);
unset($userAccounts[$key]->replacingUserAccountId);
unset($userAccounts[$key]->salt);
unset($userAccounts[$key]->tokenDate);
unset($userAccounts[$key]->lastIp);
}
return $userAccounts;
}
......
<div class="modal fade" id="disableUserModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Disable user</h4>
</div>
<div class="modal-body">
<p>
You are about to disable this user. Please chose a replacing user to complete this action.
</p>
<input type="text" class="form-control" placeholder="User" id="replacingUser" data-replacinguseraccountid=""/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" id="cancelDisabling" data-dismiss="modal" title="Close">Cancel</button>
<button type="button" class="btn btn-danger" id="confirmDisabling" data-accountid="[?merge user.accountId ?]" title="Ok">Disabled</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="enableUserModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Enable user</h4>
</div>
<div class="modal-body">
<p>
Are you sure to reactive this user ?
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" id="cancelEnabling" data-dismiss="modal" title="Close">Close</button>
<button type="button" class="btn btn-primary" id="confirmEnabling" data-accountid="[?merge user.accountId ?]" title="Yes">Yes</button>
</div>
</div>
</div>
</div>
<span class="hide" id="no_user_found_text">No user found</span>
<script >
$('#app_maarchRM_main').ready(function(){
// Define data source for person typeahead
var users = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('displayName'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {url: '/user/todisplay', ttl: '0'},
limit: 100
});
users.initialize();
// initialize typeahead
$('#replacingUser').typeahead(
{
hint: true,
highlight: true,
minLength: 3
},
// data source contacts
{
name: 'users',
displayKey: 'displayName',
templates: {
empty: function() {
return "<span class='well well-sm'>"+$('#no_user_found_text').text()+"</span>";
},
suggestion: function(user) {
var display =
"<span>"
+ "<span style='font-family:Helvetica, sans-serif;'>"
+ user.displayName;
display +=
"</span>";
display +=
"</span><br>";
$("#replacingUser").attr('data-replacinguseraccountid', user.accountId);
return display;
}
},
source: function(query, cb) {
users.search(query, function(suggestions) {
cb(suggestions);
});
},
skipCache: true
}
).on('typeahead:selected', function($event, suggestion, source) {
$("#replacingUser").attr('data-replacinguseraccountid', suggestion.userAccountId);
});
})
$('#cancelEnabling').on('click', function(){
$('#enableUser').removeClass('active').find('input').prop('checked', false);
$('#disableUser').addClass('active').find('input').prop('checked', true);
});
$('#confirmDisabling').on('click', function(){
replacingUserId = $("#replacingUser").data('replacinguseraccountid');
userAccountId = $(this).attr('data-accountid');
var parameters = {
replacingUserAccountId :replacingUserId
};
ajax($('#confirmDisabling'), {
url : '/useraccount/'+userAccountId+'/disable',
type : 'PUT',
data : JSON.stringify(parameters),
contentType : 'application/json',
dataType : 'json',
success : function(response) {
var tr = $('#'+userAccountId);
gritter.show(response.message, response.status, response.errors);
$('#disableUserModal').modal('hide');
if ($('#activatedUsers').prop('checked')) {
window.location.reload();
return;
}
tr.find('.userStatus > i').removeClass('fa-check').addClass('fa-ban');
tr.find('.disableUser').css('display', 'none');
tr.find('.enableUser').css('display', '');
},
error : function(response) {
gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
}
});
});
$('#cancelDisabling').on('click', function(){
$('#enableUser').addClass('active').find('input').prop('checked', true);
$('#disableUser').removeClass('active').find('input').prop('checked', false);
});
$('#confirmEnabling').on('click', function(){
userAccountId = $(this).attr('data-accountid');
var parameters = {
user : userAccountId
};
$.ajax({
url : '/useraccount/'+userAccountId+'/enable',
type : 'PUT',
contentType : 'application/json',
data : JSON.stringify(parameters),
dataType : 'json',
success : function(response) {
var tr = $('#'+userAccountId);
gritter.show(response.message, response.status, response.errors);
$('#enableUserModal').modal('hide');
tr.find('.userStatus > i').removeClass('fa-ban').addClass('fa-check');
tr.find('.disableUser').css('display', '');
tr.find('.enableUser').css('display', 'none');
},
error : function(response) {
gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
}
});
$('#orgUnitConfirmDelete').modal('hide');
});
</script>
\ No newline at end of file
......@@ -48,11 +48,19 @@ interface auditInterface
*/
public function readEvents($eventType = null, $fromDate = null, $toDate = null, $accountId = null, $event = null, $status = null, $term = null, $wording = null);
/**
/**
* Get event
*
* @uses audit/event/read_eventId_
* @return audit/event/getEvent
*/
public function readEvent_eventId_();
}
\ No newline at end of file
/**
* List all users to display
*
* @uses auth/userAccount/readUserlist
*/
public function readUserTodisplay();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment