nextcloud/inc/lib_user.php

135 lines
2.8 KiB
PHP
Raw Normal View History

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/>.
*
*/
if ( !$CONFIG_INSTALLED ) {
$_SESSION['user_id'] = false;
$_SESSION['username'] = '';
$_SESSION['username_clean'] = '';
}
// Cache the userid's an groupid's
if ( !isset($_SESSION['user_id_cache']) ) {
$_SESSION['user_id_cache'] = array();
}
if ( !isset($_SESSION['group_id_cache']) ) {
$_SESSION['group_id_cache'] = array();
}
2010-04-22 21:03:54 +04:00
/**
* Class for user management
2010-04-22 21:03:54 +04:00
*
*/
abstract class OC_USER_ABSTRACT {
2010-04-22 21:03:54 +04:00
/**
* Check if the login button is pressed and logg the user in
*
*/
abstract public static function loginLisener();
2010-04-22 21:03:54 +04:00
/**
* Try to create a new user
*
*/
abstract public static function createUser($username, $password);
2010-04-22 21:03:54 +04:00
/**
* Try to login a user
*
*/
abstract public static function login($username, $password);
2010-04-22 21:03:54 +04:00
/**
* Check if the logout button is pressed and logout the user
*
*/
abstract public static function logoutLisener();
2010-04-22 21:03:54 +04:00
/**
* Check if a user is logged in
*
*/
abstract public static function isLoggedIn();
2010-04-22 21:03:54 +04:00
/**
* Try to create a new group
*
*/
abstract public static function createGroup($groupName);
2010-04-22 21:03:54 +04:00
/**
* Get the ID of a user
*
*/
abstract public static function getUserId($username, $noCache=false);
2010-04-22 21:03:54 +04:00
/**
* Get the ID of a group
*
*/
abstract public static function getGroupId($groupName, $noCache=false);
/**
* Get the name of a group
*
*/
abstract public static function getGroupName($groupId, $noCache=false);
2010-04-22 21:03:54 +04:00
/**
* Check if a user belongs to a group
*
*/
abstract public static function inGroup($username, $groupName);
2010-04-22 21:03:54 +04:00
/**
* Add a user to a group
*
*/
abstract public static function addToGroup($username, $groupName);
abstract public static function generatePassword();
/**
* Get all groups the user belongs to
*
*/
abstract public static function getUserGroups($username);
/**
* Set the password of a user
*
*/
abstract public static function setPassword($username, $password);
/**
* Check the password of a user
*
*/
abstract public static function checkPassword($username, $password);
2010-04-22 21:03:54 +04:00
}