2010-04-22 21:03:54 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ownCloud
|
|
|
|
*
|
|
|
|
* @author Frank Karlitschek
|
|
|
|
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-07-15 21:10:20 +04:00
|
|
|
|
|
|
|
|
2010-07-15 22:57:14 +04:00
|
|
|
if ( !$CONFIG_INSTALLED ) {
|
2010-07-15 21:10:20 +04:00
|
|
|
$_SESSION['user_id'] = false;
|
|
|
|
$_SESSION['username'] = '';
|
|
|
|
$_SESSION['username_clean'] = '';
|
2010-04-24 14:40:20 +04:00
|
|
|
}
|
|
|
|
|
2010-07-19 20:52:49 +04:00
|
|
|
// Cache the userid's an groupid's
|
2010-07-15 22:57:14 +04:00
|
|
|
if ( !isset($_SESSION['user_id_cache']) ) {
|
2010-07-15 21:10:20 +04:00
|
|
|
$_SESSION['user_id_cache'] = array();
|
2010-06-22 03:27:44 +04:00
|
|
|
}
|
2010-07-19 20:52:49 +04:00
|
|
|
if ( !isset($_SESSION['group_id_cache']) ) {
|
2010-07-15 21:10:20 +04:00
|
|
|
$_SESSION['group_id_cache'] = array();
|
2010-06-22 03:27:44 +04:00
|
|
|
}
|
|
|
|
|
2010-07-15 21:10:20 +04:00
|
|
|
|
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Class for user management
|
2010-04-22 21:03:54 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract class OC_USER_ABSTRACT {
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Check if the login button is pressed and logg the user in
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function loginLisener();
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Try to create a new user
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function createUser($username, $password);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Try to login a user
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function login($username, $password);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Check if the logout button is pressed and logout the user
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function logoutLisener();
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Check if a user is logged in
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function isLoggedIn();
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Try to create a new group
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function createGroup($groupName);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Get the ID of a user
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function getUserId($username, $noCache=false);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Get the ID of a group
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function getGroupId($groupName, $noCache=false);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-23 02:05:04 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Get the name of a group
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function getGroupName($groupId, $noCache=false);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Check if a user belongs to a group
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function inGroup($username, $groupName);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Add a user to a group
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function addToGroup($username, $groupName);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function generatePassword();
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-23 02:05:04 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Get all groups the user belongs to
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function getUserGroups($username);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-23 02:05:04 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Set the password of a user
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function setPassword($username, $password);
|
2010-07-19 20:52:49 +04:00
|
|
|
|
2010-04-23 02:05:04 +04:00
|
|
|
/**
|
2010-07-15 22:57:14 +04:00
|
|
|
* Check the password of a user
|
2010-07-15 21:10:20 +04:00
|
|
|
*
|
|
|
|
*/
|
2010-07-19 23:33:29 +04:00
|
|
|
abstract public static function checkPassword($username, $password);
|
2010-07-15 21:10:20 +04:00
|
|
|
|
2010-04-22 21:03:54 +04:00
|
|
|
}
|