summaryrefslogtreecommitdiffstats
path: root/inc/user.inc.php
diff options
context:
space:
mode:
authorJonathan Bauer2016-04-01 16:50:13 +0200
committerJonathan Bauer2016-04-01 16:50:13 +0200
commitdbc0d9614421e064cc62aacf116ebb783c83f2f3 (patch)
tree091844b8578ff1d9ac18edfd3cee3e63210133d7 /inc/user.inc.php
parent[ldapauth] Add homedir conf to ldap wizard (diff)
downloadslx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.gz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.xz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.zip
[merge] merging c3sl / fr - initial commit
Diffstat (limited to 'inc/user.inc.php')
-rw-r--r--inc/user.inc.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/inc/user.inc.php b/inc/user.inc.php
index 111849fe..d3cdc65a 100644
--- a/inc/user.inc.php
+++ b/inc/user.inc.php
@@ -12,6 +12,13 @@ class User
return self::$user !== false;
}
+ public static function getId()
+ {
+ if (!self::isLoggedIn())
+ return false;
+ return self::$user['userid'];
+ }
+
public static function getName()
{
if (!self::isLoggedIn())
@@ -58,6 +65,7 @@ class User
public static function logout()
{
+ error_log("in logout");
Session::delete();
Header('Location: ?do=Main&fromlogout');
exit(0);
@@ -81,4 +89,19 @@ class User
return self::$user['lasteventid'];
}
+ public static function addUser($data){
+ Database::exec ( "INSERT INTO user SET login = :login, passwd = :pass, fullname = :name, phone = :phone, email = :email, permissions = 4", $data );
+ $ret = Database::queryFirst('SELECT userid FROM user WHERE login = :user LIMIT 1', array('user' => $data['login']));
+ $user = array(
+ 'user' => $ret['userid']
+ );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '44', size = '5G', mount_point = '/tmp', user = :user", $user );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '43', size = '20G', mount_point = '/boot', options = 'bootable', user = :user", $user );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '40', size = '20G', mount_point = '/cache/export/dnbd3', user = :user", $user );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '41', size = '5G', mount_point = '/home', user = :user", $user );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '82', size = '1G', user = :user", $user );
+ Message::addSuccess('add-user');
+ EventLog::info ( User::getName () . ' created user ' . $data['login'] );
+ }
+
}