Merge pull request #1598 from owncloud/fixing-1424-master

Fixing 1424 master
remotes/origin/stable5
Thomas Müller 12 years ago
commit e1e77fe3be
  1. 6
      apps/user_ldap/user_ldap.php
  2. 8
      apps/user_ldap/user_proxy.php
  3. 12
      apps/user_webdavauth/user_webdavauth.php
  4. 15
      lib/user.php
  5. 10
      lib/user/backend.php
  6. 8
      lib/user/database.php
  7. 7
      lib/user/dummy.php
  8. 7
      lib/user/interface.php
  9. 6
      settings/ajax/createuser.php
  10. 6
      settings/js/users.js

@ -261,4 +261,10 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface {
return (bool)((OC_USER_BACKEND_CHECK_PASSWORD | OC_USER_BACKEND_GET_HOME) & $actions);
}
/**
* @return bool
*/
public function hasUserListings() {
return true;
}
}

@ -183,4 +183,12 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
public function deleteUser($uid) {
return false;
}
/**
* @return bool
*/
public function hasUserListings() {
return $this->refBackend->hasUserListings();
}
}

@ -28,12 +28,6 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
$this->webdavauth_url = OC_Config::getValue( "user_webdavauth_url" );
}
public function createUser() {
// Can't create user
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to create users from web frontend using WebDAV user backend', 3);
return false;
}
public function deleteUser($uid) {
// Can't delete user
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to delete users from web frontend using WebDAV user backend', 3);
@ -71,6 +65,12 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
return true;
}
/**
* @return bool
*/
public function hasUserListings() {
return false;
}
/*
* we don´t know the users so all we can do it return an empty array here

@ -172,7 +172,7 @@ class OC_User {
}
// Check if user already exists
if( self::userExists($uid) ) {
if( self::userExistsForCreation($uid) ) {
throw new Exception('The username is already being used');
}
@ -553,6 +553,19 @@ class OC_User {
return false;
}
public static function userExistsForCreation($uid) {
foreach(self::$_usedBackends as $backend) {
if(!$backend->hasUserListings())
continue;
$result=$backend->userExists($uid);
if($result===true) {
return true;
}
}
return false;
}
/**
* disables a user
* @param string $userid the user to disable

@ -136,7 +136,7 @@ abstract class OC_User_Backend implements OC_User_Interface {
/**
* @brief Get a list of all display names
* @returns array with all displayNames (value) and the correspondig uids (key)
* @returns array with all displayNames (value) and the corresponding uids (key)
*
* Get a list of all display names and user ids.
*/
@ -148,4 +148,12 @@ abstract class OC_User_Backend implements OC_User_Interface {
}
return $displayNames;
}
/**
* @brief Check if a user list is available or not
* @return boolean if users can be listed or not
*/
public function hasUserListings() {
return false;
}
}

@ -256,4 +256,12 @@ class OC_User_Database extends OC_User_Backend {
return false;
}
}
/**
* @return bool
*/
public function hasUserListings() {
return true;
}
}

@ -112,4 +112,11 @@ class OC_User_Dummy extends OC_User_Backend {
public function userExists($uid) {
return isset($this->users[$uid]);
}
/**
* @return bool
*/
public function hasUserListings() {
return true;
}
}

@ -66,10 +66,15 @@ interface OC_User_Interface {
/**
* @brief Get a list of all display names
* @returns array with all displayNames (value) and the correspondig uids (key)
* @returns array with all displayNames (value) and the corresponding uids (key)
*
* Get a list of all display names and user ids.
*/
public function getDisplayNames($search = '', $limit = null, $offset = null);
/**
* @brief Check if a user list is available or not
* @return boolean if users can be listed or not
*/
public function hasUserListings();
}

@ -26,12 +26,6 @@ if(OC_User::isAdminUser(OC_User::getUser())) {
$username = $_POST["username"];
$password = $_POST["password"];
// Does the group exist?
if(OC_User::userExists($username)) {
OC_JSON::error(array("data" => array( "message" => "User already exists" )));
exit();
}
// Return Success story
try {
if (!OC_User::createUser($username, $password)) {

@ -346,12 +346,6 @@ $(document).ready(function () {
event.preventDefault();
var username = $('#newusername').val();
var password = $('#newuserpassword').val();
if ($('#content table tbody tr').filterAttr('data-uid', username).length > 0) {
OC.dialogs.alert(
t('settings', 'The username is already being used'),
t('settings', 'Error creating user'));
return;
}
if ($.trim(username) == '') {
OC.dialogs.alert(
t('settings', 'A valid username must be provided'),

Loading…
Cancel
Save