Merge pull request #5476 from owncloud/admin-showwarningwhenhomeexists
Added warning notification when user home already exists
This commit is contained in:
commit
6eec8b2550
|
@ -38,8 +38,15 @@ try {
|
||||||
}
|
}
|
||||||
OC_Group::addToGroup( $username, $i );
|
OC_Group::addToGroup( $username, $i );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check whether the user's files home exists
|
||||||
|
$userDirectory = OC_User::getHome($username) . '/files/';
|
||||||
|
$homeExists = file_exists($userDirectory);
|
||||||
|
|
||||||
OC_JSON::success(array("data" =>
|
OC_JSON::success(array("data" =>
|
||||||
array(
|
array(
|
||||||
|
// returns whether the home already existed
|
||||||
|
"homeExists" => $homeExists,
|
||||||
"username" => $username,
|
"username" => $username,
|
||||||
"groups" => OC_Group::getUserGroups( $username ))));
|
"groups" => OC_Group::getUserGroups( $username ))));
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
|
|
@ -467,6 +467,18 @@ $(document).ready(function () {
|
||||||
var addedGroups = result.data.groups;
|
var addedGroups = result.data.groups;
|
||||||
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
|
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
|
||||||
}
|
}
|
||||||
|
if (result.data.homeExists){
|
||||||
|
OC.Notification.hide();
|
||||||
|
OC.Notification.show(t('settings', 'Warning: Home directory for user "{user}" already exists', {user: result.data.username}));
|
||||||
|
if (UserList.notificationTimeout){
|
||||||
|
window.clearTimeout(UserList.notificationTimeout);
|
||||||
|
}
|
||||||
|
UserList.notificationTimeout = window.setTimeout(
|
||||||
|
function(){
|
||||||
|
OC.Notification.hide();
|
||||||
|
UserList.notificationTimeout = null;
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
if($('tr[data-uid="' + username + '"]').length === 0) {
|
if($('tr[data-uid="' + username + '"]').length === 0) {
|
||||||
UserList.add(username, username, result.data.groups, null, 'default', true);
|
UserList.add(username, username, result.data.groups, null, 'default', true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue