Implemented visual feedback if a user is disabled in admin user menu.
Implemented visuals for enabling/disabling user from admin user list. Added the controller functions for enabling/disabling a user. Added the route for changing user status (enabled/disabled) and added an additional route handler in the user controller. Finished the visuals to reflect current user status and changed user status respectively. Changed the single icon for enabling/disabling a user into a menu where deletion and state toggling of a user is selectable. Added displaying of disabled user count. Improved style of user action menu. Added proper counting of disabled users. Removed visual indicator for disabled users. Moved pseudo-group detection for disabled users from frontend to the controller. Changed units for newly introduced css values from em to px. Removed unnecessary png and optimized svg with scour. Changed the userlist template to display the user action menu with correct width. Style fixes for better readability and coding style conformity. Changed the icons for enabling, disabling and deleting a user in the action menu.
This commit is contained in:
parent
1307800561
commit
637c75bca1
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.1" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#">
|
||||||
|
<metadata>
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<path d="m576 896q-159 0-271.5-112.5t-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5-112.5 271.5-271.5 112.5zm960 128h352q13 0 22.5 9.5t9.5 22.5v192q0 13-9.5 22.5t-22.5 9.5h-352v352q0 13-9.5 22.5t-22.5 9.5h-192q-13 0-22.5-9.5t-9.5-22.5v-352h-352q-13 0-22.5-9.5t-9.5-22.5v-192q0-13 9.5-22.5t22.5-9.5h352v-352q0-13 9.5-22.5t22.5-9.5h192q13 0 22.5 9.5t9.5 22.5v352zm-736 224q0 52 38 90t90 38h256v238q-68 50-171 50h-874q-121 0-194-69t-73-190q0-53 3.5-103.5t14-109 26.5-108.5 43-97.5 62-81 85.5-53.5 111.5-20q19 0 39 17 79 61 154.5 91.5t164.5 30.5 164.5-30.5 154.5-91.5q20-17 39-17 132 0 217 96h-223q-52 0-90 38t-38 90v192z"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg version="1.1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" viewBox="0 0 1792 1792">
|
||||||
|
<metadata>
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<path d="m576 896q-159 0-271.5-112.5t-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5-112.5 271.5-271.5 112.5zm1077 320l249 249q9 9 9 23 0 13-9 22l-136 136q-9 9-22 9-14 0-23-9l-249-249-249 249q-9 9-23 9-13 0-22-9l-136-136q-9-9-9-22 0-14 9-23l249-249-249-249q-9-9-9-23 0-13 9-22l136-136q9-9 22-9 14 0 23 9l249 249 249-249q9-9 23-9 13 0 22 9l136 136q9 9 9 22 0 14-9 23zm-498 0l-181 181q-37 37-37 91 0 53 37 90l83 83q-21 3-44 3h-874q-121 0-194-69t-73-190q0-53 3.5-103.5t14-109 26.5-108.5 43-97.5 62-81 85.5-53.5 111.5-20q19 0 39 17 154 122 319 122t319-122q20-17 39-17 28 0 57 6-28 27-41 50t-13 56q0 54 37 91z"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -225,6 +225,7 @@ class UsersController extends Controller {
|
||||||
'email' => $displayName,
|
'email' => $displayName,
|
||||||
'isRestoreDisabled' => !$restorePossible,
|
'isRestoreDisabled' => !$restorePossible,
|
||||||
'isAvatarAvailable' => $avatarAvailable,
|
'isAvatarAvailable' => $avatarAvailable,
|
||||||
|
'isEnabled' => $user->isEnabled(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,11 +254,6 @@ class UsersController extends Controller {
|
||||||
* TODO: Tidy up and write unit tests - code is mainly static method calls
|
* TODO: Tidy up and write unit tests - code is mainly static method calls
|
||||||
*/
|
*/
|
||||||
public function index($offset = 0, $limit = 10, $gid = '', $pattern = '', $backend = '') {
|
public function index($offset = 0, $limit = 10, $gid = '', $pattern = '', $backend = '') {
|
||||||
// FIXME: The JS sends the group '_everyone' instead of no GID for the "all users" group.
|
|
||||||
if($gid === '_everyone') {
|
|
||||||
$gid = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove backends
|
// Remove backends
|
||||||
if(!empty($backend)) {
|
if(!empty($backend)) {
|
||||||
$activeBackends = $this->userManager->getBackends();
|
$activeBackends = $this->userManager->getBackends();
|
||||||
|
@ -272,15 +268,18 @@ class UsersController extends Controller {
|
||||||
|
|
||||||
$users = [];
|
$users = [];
|
||||||
if ($this->isAdmin) {
|
if ($this->isAdmin) {
|
||||||
|
if($gid !== '' && $gid !== 'disabledUsers') {
|
||||||
if($gid !== '') {
|
|
||||||
$batch = $this->getUsersForUID($this->groupManager->displayNamesInGroup($gid, $pattern, $limit, $offset));
|
$batch = $this->getUsersForUID($this->groupManager->displayNamesInGroup($gid, $pattern, $limit, $offset));
|
||||||
} else {
|
} else {
|
||||||
$batch = $this->userManager->search($pattern, $limit, $offset);
|
$batch = $this->userManager->search($pattern, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($batch as $user) {
|
foreach ($batch as $user) {
|
||||||
$users[] = $this->formatUserForIndex($user);
|
if( ($gid !== 'disabledUsers' && $user->isEnabled()) ||
|
||||||
|
($gid === 'disabledUsers' && !$user->isEnabled())
|
||||||
|
) {
|
||||||
|
$users[] = $this->formatUserForIndex($user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -293,7 +292,7 @@ class UsersController extends Controller {
|
||||||
$subAdminOfGroups = $gids;
|
$subAdminOfGroups = $gids;
|
||||||
|
|
||||||
// Set the $gid parameter to an empty value if the subadmin has no rights to access a specific group
|
// Set the $gid parameter to an empty value if the subadmin has no rights to access a specific group
|
||||||
if($gid !== '' && !in_array($gid, $subAdminOfGroups)) {
|
if($gid !== '' && $gid !== 'disabledUsers' && !in_array($gid, $subAdminOfGroups)) {
|
||||||
$gid = '';
|
$gid = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +317,11 @@ class UsersController extends Controller {
|
||||||
$this->groupManager->getUserGroupIds($user),
|
$this->groupManager->getUserGroupIds($user),
|
||||||
$subAdminOfGroups
|
$subAdminOfGroups
|
||||||
));
|
));
|
||||||
$users[] = $this->formatUserForIndex($user, $userGroups);
|
if( ($gid !== 'disabledUsers' && $user->isEnabled()) ||
|
||||||
|
($gid === 'disabledUsers' && !$user->isEnabled())
|
||||||
|
) {
|
||||||
|
$users[] = $this->formatUserForIndex($user, $userGroups);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,6 +516,137 @@ class UsersController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
* @return DataResponse
|
||||||
|
*/
|
||||||
|
public function disable($id) {
|
||||||
|
$userId = $this->userSession->getUser()->getUID();
|
||||||
|
$user = $this->userManager->get($id);
|
||||||
|
|
||||||
|
if($userId === $id) {
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'error',
|
||||||
|
'data' => array(
|
||||||
|
'message' => (string)$this->l10n->t('Unable to disable user.')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Http::STATUS_FORBIDDEN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) {
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'error',
|
||||||
|
'data' => array(
|
||||||
|
'message' => (string)$this->l10n->t('Authentication error')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Http::STATUS_FORBIDDEN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($user) {
|
||||||
|
$user->setEnabled(false);
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'success',
|
||||||
|
'data' => array(
|
||||||
|
'username' => $id,
|
||||||
|
'enabled' => 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'error',
|
||||||
|
'data' => array(
|
||||||
|
'message' => (string)$this->l10n->t('Unable to disable user.')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
* @return DataResponse
|
||||||
|
*/
|
||||||
|
public function enable($id) {
|
||||||
|
$userId = $this->userSession->getUser()->getUID();
|
||||||
|
$user = $this->userManager->get($id);
|
||||||
|
|
||||||
|
if($userId === $id) {
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'error',
|
||||||
|
'data' => array(
|
||||||
|
'message' => (string)$this->l10n->t('Unable to enable user.')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Http::STATUS_FORBIDDEN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) {
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'error',
|
||||||
|
'data' => array(
|
||||||
|
'message' => (string)$this->l10n->t('Authentication error')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Http::STATUS_FORBIDDEN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($user) {
|
||||||
|
$user->setEnabled(true);
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'success',
|
||||||
|
'data' => array(
|
||||||
|
'username' => $id,
|
||||||
|
'enabled' => 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return new DataResponse(
|
||||||
|
array(
|
||||||
|
'status' => 'error',
|
||||||
|
'data' => array(
|
||||||
|
'message' => (string)$this->l10n->t('Unable to enable user.')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
* @param int $enabled
|
||||||
|
* @return DataResponse
|
||||||
|
*/
|
||||||
|
public function setEnabled($id, $enabled) {
|
||||||
|
if((bool)$enabled) {
|
||||||
|
return $this->enable($id);
|
||||||
|
} else {
|
||||||
|
return $this->disable($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mail address of a user
|
||||||
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoSubadminRequired
|
* @NoSubadminRequired
|
||||||
* @PasswordConfirmationRequired
|
* @PasswordConfirmationRequired
|
||||||
|
|
|
@ -458,15 +458,16 @@ table.grid th, table.grid td {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
td.name, td.password { padding-left:.8em; }
|
td.name, td.password { padding-left:.8em; }
|
||||||
td.password>img,td.displayName>img, td.remove>a, td.quota>img { visibility:hidden; vertical-align: middle;}
|
td.password>img,td.displayName>img, td.quota>img { visibility:hidden; }
|
||||||
td.password, td.quota, td.displayName { width:12em; cursor:pointer; }
|
td.password, td.quota, td.displayName { width:12em; cursor:pointer; }
|
||||||
td.password>span, td.quota>span, rd.displayName>span { margin-right: 1.2em; color: #C7C7C7; }
|
td.password>span, td.quota>span, td.displayName>span { margin-right: 1.2em; color: #C7C7C7; }
|
||||||
span.usersLastLoginTooltip { white-space: nowrap; }
|
span.usersLastLoginTooltip { white-space: nowrap; }
|
||||||
|
|
||||||
/* dropdowns will be relative to this element */
|
/* dropdowns will be relative to this element */
|
||||||
#userlist {
|
#userlist {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
#userlist .mailAddress,
|
#userlist .mailAddress,
|
||||||
#userlist .storageLocation,
|
#userlist .storageLocation,
|
||||||
#userlist .userBackend,
|
#userlist .userBackend,
|
||||||
|
@ -501,13 +502,41 @@ span.usersLastLoginTooltip { white-space: nowrap; }
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; }
|
.bubble {
|
||||||
tr:hover>td.remove>a, tr:hover>td.password>img,tr:hover>td.displayName>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; }
|
z-index:1;
|
||||||
td.remove {
|
right: -5px;
|
||||||
width: 25px;
|
|
||||||
}
|
}
|
||||||
tr:hover>td.remove>a {
|
.bubble:after {
|
||||||
float: left;
|
right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popovermenu a.menuitem {
|
||||||
|
padding: 10px;
|
||||||
|
margin: -5px -10px -5px -15px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#userlist .popovermenu {
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#userlist .popovermenu>ul.userActionsMenu {
|
||||||
|
right: 10px;
|
||||||
|
padding: 0 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#userlist .popovermenu>ul.userActionsMenu a span {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#userlist .popovermenu {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; }
|
||||||
|
tr:hover>td.password>img,tr:hover>td.displayName>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; }
|
||||||
|
td.userActions {
|
||||||
|
width: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.recoveryPassword { left:50em; display:block; position:absolute; top:-1px; }
|
div.recoveryPassword { left:50em; display:block; position:absolute; top:-1px; }
|
||||||
|
|
|
@ -48,7 +48,8 @@ GroupList = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getUserCount: function ($groupLiElement) {
|
getUserCount: function ($groupLiElement) {
|
||||||
return parseInt($groupLiElement.data('usercount'), 10);
|
var count = parseInt($groupLiElement.data('usercount'), 10);
|
||||||
|
return isNaN(count) ? 0 : count;
|
||||||
},
|
},
|
||||||
|
|
||||||
modGroupCount: function(gid, diff) {
|
modGroupCount: function(gid, diff) {
|
||||||
|
@ -208,10 +209,17 @@ GroupList = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showDisabledUsers: function () {
|
||||||
|
UserList.empty();
|
||||||
|
UserList.update('disabledUsers');
|
||||||
|
$userGroupList.find('li').removeClass('active');
|
||||||
|
GroupList.getGroupLI('disabledUsers').addClass('active');
|
||||||
|
},
|
||||||
|
|
||||||
showGroup: function (gid) {
|
showGroup: function (gid) {
|
||||||
GroupList.activeGID = gid;
|
GroupList.activeGID = gid;
|
||||||
UserList.empty();
|
UserList.empty();
|
||||||
UserList.update(gid);
|
UserList.update(gid === '_everyone' ? '' : gid);
|
||||||
$userGroupList.find('li').removeClass('active');
|
$userGroupList.find('li').removeClass('active');
|
||||||
if (gid !== undefined) {
|
if (gid !== undefined) {
|
||||||
//TODO: treat Everyone properly
|
//TODO: treat Everyone properly
|
||||||
|
@ -364,6 +372,11 @@ $(document).ready( function () {
|
||||||
GroupList.showGroup(GroupList.getElementGID(this));
|
GroupList.showGroup(GroupList.getElementGID(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// show disabled users
|
||||||
|
$userGroupList.on('click', '.disabledusers', function () {
|
||||||
|
GroupList.showDisabledUsers();
|
||||||
|
});
|
||||||
|
|
||||||
$('#newgroupname').on('input', function(){
|
$('#newgroupname').on('input', function(){
|
||||||
GroupList.handleAddGroupInput(this.value);
|
GroupList.handleAddGroupInput(this.value);
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,11 +48,12 @@ var UserList = {
|
||||||
* 'backend': 'LDAP',
|
* 'backend': 'LDAP',
|
||||||
* 'email': 'username@example.org'
|
* 'email': 'username@example.org'
|
||||||
* 'isRestoreDisabled':false
|
* 'isRestoreDisabled':false
|
||||||
|
* 'isEnabled': true
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
add: function (user) {
|
add: function (user) {
|
||||||
if (this.currentGid && this.currentGid !== '_everyone' && _.indexOf(user.groups, this.currentGid) < 0) {
|
if (this.currentGid && this.currentGid !== '_everyone' && this.currentGid !== 'disabledUsers' && _.indexOf(user.groups, this.currentGid) < 0) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $tr = $userListBody.find('tr:first-child').clone();
|
var $tr = $userListBody.find('tr:first-child').clone();
|
||||||
|
@ -77,6 +78,7 @@ var UserList = {
|
||||||
$tr.data('displayname', user.displayname);
|
$tr.data('displayname', user.displayname);
|
||||||
$tr.data('mailAddress', user.email);
|
$tr.data('mailAddress', user.email);
|
||||||
$tr.data('restoreDisabled', user.isRestoreDisabled);
|
$tr.data('restoreDisabled', user.isRestoreDisabled);
|
||||||
|
$tr.data('userEnabled', user.isEnabled);
|
||||||
$tr.find('.name').text(user.name);
|
$tr.find('.name').text(user.name);
|
||||||
$tr.find('td.displayName > span').text(user.displayname);
|
$tr.find('td.displayName > span').text(user.displayname);
|
||||||
$tr.find('td.mailAddress > span').text(user.email);
|
$tr.find('td.mailAddress > span').text(user.email);
|
||||||
|
@ -97,18 +99,17 @@ var UserList = {
|
||||||
$tdSubadmins.find('.action').tooltip({placement: 'top'});
|
$tdSubadmins.find('.action').tooltip({placement: 'top'});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove action
|
* user actions menu
|
||||||
*/
|
*/
|
||||||
if ($tr.find('td.remove img').length === 0 && OC.currentUser !== user.name) {
|
if ($tr.find('td.userActions > span > img').length === 0 && OC.currentUser !== user.name) {
|
||||||
var deleteImage = $('<img class="action">').attr({
|
var menuImage = $('<img class="svg action">').attr({
|
||||||
src: OC.imagePath('core', 'actions/delete')
|
src: OC.imagePath('core', 'actions/more')
|
||||||
});
|
});
|
||||||
var deleteLink = $('<a class="action delete">')
|
var menuLink = $('<span class="toggleUserActions"></span>')
|
||||||
.attr({ href: '#', 'original-title': t('settings', 'Delete')})
|
.append(menuImage);
|
||||||
.append(deleteImage);
|
$tr.find('td.userActions > span').replaceWith(menuLink);
|
||||||
$tr.find('td.remove').append(deleteLink);
|
|
||||||
} else if (OC.currentUser === user.name) {
|
} else if (OC.currentUser === user.name) {
|
||||||
$tr.find('td.remove a').remove();
|
$tr.find('td.userActions').empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,14 +161,6 @@ var UserList = {
|
||||||
* append generated row to user list
|
* append generated row to user list
|
||||||
*/
|
*/
|
||||||
$tr.appendTo($userList);
|
$tr.appendTo($userList);
|
||||||
if(UserList.isEmpty === true) {
|
|
||||||
//when the list was emptied, one row was left, necessary to keep
|
|
||||||
//add working and the layout unbroken. We need to remove this item
|
|
||||||
$tr.show();
|
|
||||||
$userListBody.find('tr:first').remove();
|
|
||||||
UserList.isEmpty = false;
|
|
||||||
UserList.checkUsersToLoad();
|
|
||||||
}
|
|
||||||
|
|
||||||
$quotaSelect.on('change', UserList.onQuotaSelect);
|
$quotaSelect.on('change', UserList.onQuotaSelect);
|
||||||
|
|
||||||
|
@ -338,6 +331,9 @@ var UserList = {
|
||||||
getRestoreDisabled: function(element) {
|
getRestoreDisabled: function(element) {
|
||||||
return ($(element).closest('tr').data('restoreDisabled') || '');
|
return ($(element).closest('tr').data('restoreDisabled') || '');
|
||||||
},
|
},
|
||||||
|
getUserEnabled: function(element) {
|
||||||
|
return ($(element).closest('tr').data('userEnabled') || '');
|
||||||
|
},
|
||||||
initDeleteHandling: function() {
|
initDeleteHandling: function() {
|
||||||
//set up handler
|
//set up handler
|
||||||
UserDeleteHandler = new DeleteHandler('/settings/users/users', 'username',
|
UserDeleteHandler = new DeleteHandler('/settings/users/users', 'username',
|
||||||
|
@ -351,7 +347,7 @@ var UserList = {
|
||||||
UserList.undoRemove);
|
UserList.undoRemove);
|
||||||
|
|
||||||
//when to mark user for delete
|
//when to mark user for delete
|
||||||
$userListBody.on('click', '.delete', function () {
|
$userListBody.on('click', '.action-remove', function () {
|
||||||
// Call function for handling delete/undo
|
// Call function for handling delete/undo
|
||||||
var uid = UserList.getUID(this);
|
var uid = UserList.getUID(this);
|
||||||
|
|
||||||
|
@ -908,6 +904,54 @@ $(document).ready(function () {
|
||||||
UserList._triggerGroupEdit($td, isSubadminSelect);
|
UserList._triggerGroupEdit($td, isSubadminSelect);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$userListBody.on('click', '.toggleUserActions', function (event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
var $td = $(this).closest('td');
|
||||||
|
var $tr = $($td).closest('tr');
|
||||||
|
var menudiv = $td.find('.popovermenu');
|
||||||
|
|
||||||
|
if(menudiv.is(':visible')) {
|
||||||
|
menudiv.fadeOut(100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
menudiv.find('.action-togglestate').empty();
|
||||||
|
if($tr.data('userEnabled')) {
|
||||||
|
$('.action-togglestate', $td).html('<span class="icon icon-close"></span><span>'+t('settings', 'Disable')+'</span>');
|
||||||
|
} else {
|
||||||
|
$('.action-togglestate', $td).html('<span class="icon icon-add"></span><span>'+t('settings', 'Enable')+'</span>');
|
||||||
|
}
|
||||||
|
menudiv.click(function() { menudiv.fadeOut(100); });
|
||||||
|
menudiv.hover('', function() { menudiv.fadeOut(100); });
|
||||||
|
menudiv.fadeIn(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
$userListBody.on('click', '.action-togglestate', function (event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
var $td = $(this).closest('td');
|
||||||
|
var $tr = $td.closest('tr');
|
||||||
|
var uid = UserList.getUID($td);
|
||||||
|
var setEnabled = UserList.getUserEnabled($td) ? 0 : 1;
|
||||||
|
$.post(
|
||||||
|
OC.generateUrl('/settings/users/{id}/setEnabled', {id: uid}),
|
||||||
|
{username: uid, enabled: setEnabled},
|
||||||
|
function (result) {
|
||||||
|
if (result && result.status==='success'){
|
||||||
|
var count = GroupList.getUserCount(GroupList.getGroupLI('disabledUsers'));
|
||||||
|
$tr.remove();
|
||||||
|
if(result.data.enabled == 1) {
|
||||||
|
$tr.data('userEnabled', true);
|
||||||
|
GroupList.setUserCount(GroupList.getGroupLI('disabledUsers'), count-1);
|
||||||
|
} else {
|
||||||
|
$tr.data('userEnabled', false);
|
||||||
|
GroupList.setUserCount(GroupList.getGroupLI('disabledUsers'), count+1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OC.dialogs.alert(result.data.message, t('settings', 'Unable to change status of {user}', {user: uid}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// init the quota field select box after it is shown the first time
|
// init the quota field select box after it is shown the first time
|
||||||
$('#app-settings').one('show', function() {
|
$('#app-settings').one('show', function() {
|
||||||
$(this).find('#default_quota').singleSelect().on('change', UserList.onQuotaSelect);
|
$(this).find('#default_quota').singleSelect().on('change', UserList.onQuotaSelect);
|
||||||
|
|
|
@ -53,6 +53,7 @@ $application->registerRoutes($this, [
|
||||||
['name' => 'Users#setEMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT'],
|
['name' => 'Users#setEMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT'],
|
||||||
['name' => 'Users#setUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT'],
|
['name' => 'Users#setUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT'],
|
||||||
['name' => 'Users#getVerificationCode', 'url' => '/settings/users/{account}/verify', 'verb' => 'GET'],
|
['name' => 'Users#getVerificationCode', 'url' => '/settings/users/{account}/verify', 'verb' => 'GET'],
|
||||||
|
['name' => 'Users#setEnabled', 'url' => '/settings/users/{id}/setEnabled', 'verb' => 'POST'],
|
||||||
['name' => 'Users#stats', 'url' => '/settings/users/stats', 'verb' => 'GET'],
|
['name' => 'Users#stats', 'url' => '/settings/users/stats', 'verb' => 'GET'],
|
||||||
['name' => 'LogSettings#setLogLevel', 'url' => '/settings/admin/log/level', 'verb' => 'POST'],
|
['name' => 'LogSettings#setLogLevel', 'url' => '/settings/admin/log/level', 'verb' => 'POST'],
|
||||||
['name' => 'LogSettings#getEntries', 'url' => '/settings/admin/log/entries', 'verb' => 'GET'],
|
['name' => 'LogSettings#getEntries', 'url' => '/settings/admin/log/entries', 'verb' => 'GET'],
|
||||||
|
|
|
@ -37,6 +37,15 @@
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<!-- Disabled Users -->
|
||||||
|
<?php $disabledUsersGroup = $_["disabledUsersGroup"] ?>
|
||||||
|
<li data-gid="disabledUsers" data-usercount="<?php if($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?>" class="isgroup">
|
||||||
|
<a href="#"><span class="groupname"><?php p($l->t('Disabled')); ?></span></a>
|
||||||
|
<span class="utils">
|
||||||
|
<span class="usercount"><?php if($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?></span>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
<!--List of Groups-->
|
<!--List of Groups-->
|
||||||
<?php foreach($_["groups"] as $group): ?>
|
<?php foreach($_["groups"] as $group): ?>
|
||||||
<li data-gid="<?php p($group['name']) ?>" data-usercount="<?php p($group['usercount']) ?>" class="isgroup">
|
<li data-gid="<?php p($group['name']) ?>" data-usercount="<?php p($group['usercount']) ?>" class="isgroup">
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<th class="storageLocation" scope="col"><?php p($l->t('Storage location')); ?></th>
|
<th class="storageLocation" scope="col"><?php p($l->t('Storage location')); ?></th>
|
||||||
<th class="userBackend" scope="col"><?php p($l->t('User backend')); ?></th>
|
<th class="userBackend" scope="col"><?php p($l->t('User backend')); ?></th>
|
||||||
<th class="lastLogin" scope="col"><?php p($l->t('Last login')); ?></th>
|
<th class="lastLogin" scope="col"><?php p($l->t('Last login')); ?></th>
|
||||||
<th id="headerRemove"> </th>
|
<th class="userActions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -63,7 +63,21 @@
|
||||||
<td class="storageLocation"></td>
|
<td class="storageLocation"></td>
|
||||||
<td class="userBackend"></td>
|
<td class="userBackend"></td>
|
||||||
<td class="lastLogin"></td>
|
<td class="lastLogin"></td>
|
||||||
<td class="remove"></td>
|
<td class="userActions"><span></span>
|
||||||
|
<div class="popovermenu bubble open menu">
|
||||||
|
<ul class="userActionsMenu">
|
||||||
|
<li>
|
||||||
|
<a href="#" class="menuitem action-togglestate permanent" data-action="togglestate"></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#" class="menuitem action-remove permanent" data-action="remove">
|
||||||
|
<span class="icon icon-delete"></span>
|
||||||
|
<span><?php p($l->t('Delete')); ?></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -59,12 +59,15 @@ $config = \OC::$server->getConfig();
|
||||||
|
|
||||||
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
|
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
|
||||||
|
|
||||||
|
$isDisabled = !OC_User::isEnabled(OC_User::getUser());
|
||||||
|
|
||||||
$groupsInfo = new \OC\Group\MetaData(
|
$groupsInfo = new \OC\Group\MetaData(
|
||||||
OC_User::getUser(),
|
OC_User::getUser(),
|
||||||
$isAdmin,
|
$isAdmin,
|
||||||
$groupManager,
|
$groupManager,
|
||||||
\OC::$server->getUserSession()
|
\OC::$server->getUserSession()
|
||||||
);
|
);
|
||||||
|
|
||||||
$groupsInfo->setSorting($sortGroupsBy);
|
$groupsInfo->setSorting($sortGroupsBy);
|
||||||
list($adminGroup, $groups) = $groupsInfo->get();
|
list($adminGroup, $groups) = $groupsInfo->get();
|
||||||
|
|
||||||
|
@ -92,6 +95,17 @@ if($isAdmin) {
|
||||||
}
|
}
|
||||||
$subAdmins = false;
|
$subAdmins = false;
|
||||||
}
|
}
|
||||||
|
$disabledUsers = 0;
|
||||||
|
foreach (OC_User::getUsers() as $uid) {
|
||||||
|
if(!$userManager->get($uid)->isEnabled()) {
|
||||||
|
$disabledUsers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$disabledUsersGroup = array(
|
||||||
|
'id' => 'disabledUsers',
|
||||||
|
'name' => 'disabledUsers',
|
||||||
|
'usercount' => $disabledUsers
|
||||||
|
);
|
||||||
|
|
||||||
// load preset quotas
|
// load preset quotas
|
||||||
$quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
|
$quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
|
||||||
|
@ -111,6 +125,7 @@ $tmpl = new OC_Template("settings", "users/main", "user");
|
||||||
$tmpl->assign('groups', $groups);
|
$tmpl->assign('groups', $groups);
|
||||||
$tmpl->assign('sortGroups', $sortGroupsBy);
|
$tmpl->assign('sortGroups', $sortGroupsBy);
|
||||||
$tmpl->assign('adminGroup', $adminGroup);
|
$tmpl->assign('adminGroup', $adminGroup);
|
||||||
|
$tmpl->assign('disabledUsersGroup', $disabledUsersGroup);
|
||||||
$tmpl->assign('isAdmin', (int)$isAdmin);
|
$tmpl->assign('isAdmin', (int)$isAdmin);
|
||||||
$tmpl->assign('subadmins', $subAdmins);
|
$tmpl->assign('subadmins', $subAdmins);
|
||||||
$tmpl->assign('numofgroups', count($groups) + count($adminGroup));
|
$tmpl->assign('numofgroups', count($groups) + count($adminGroup));
|
||||||
|
|
Loading…
Reference in New Issue