summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-04-17 01:04:23 +0200
committerJakob Sack <kde@jakobsack.de>2011-04-17 01:04:23 +0200
commitc4287162c4fb16e5b85a103aabbbbe7a7eebe4c7 (patch)
tree40ce06b0efc339956b7f5c117e87827cd094ce10 /lib
parentb129079bed8ebd1b5051dabe15eccdc17bf4b403 (diff)
downloadnextcloud-server-c4287162c4fb16e5b85a103aabbbbe7a7eebe4c7.tar.gz
nextcloud-server-c4287162c4fb16e5b85a103aabbbbe7a7eebe4c7.zip
Some work on the fancy user management
Diffstat (limited to 'lib')
-rw-r--r--lib/Group/backend.php7
-rw-r--r--lib/Group/database.php12
-rw-r--r--lib/User/backend.php6
-rw-r--r--lib/User/database.php12
-rw-r--r--lib/app.php4
-rw-r--r--lib/filestorage.php7
-rw-r--r--lib/group.php18
-rw-r--r--lib/user.php8
8 files changed, 67 insertions, 7 deletions
diff --git a/lib/Group/backend.php b/lib/Group/backend.php
index f34c340be8c..c3f208157e4 100644
--- a/lib/Group/backend.php
+++ b/lib/Group/backend.php
@@ -36,6 +36,13 @@ abstract class OC_GROUP_BACKEND {
public static function createGroup($groupName){}
/**
+ * Try to delete Group
+ *
+ * @param string $groupName The name of the group to delete
+ */
+ public static function deleteGroup($groupName){}
+
+ /**
* Check if a user belongs to a group
*
* @param string $username Name of the user to check
diff --git a/lib/Group/database.php b/lib/Group/database.php
index e3e6c825b9f..aea27a3d6d8 100644
--- a/lib/Group/database.php
+++ b/lib/Group/database.php
@@ -67,6 +67,18 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND {
}
/**
+ * Try to delete a group
+ *
+ * @param string $groupName The name of the group to delete
+ */
+ public static function deleteGroup( $gid ){
+ $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE `gid` = ?" );
+ $result = $query->execute( array( $gid ));
+
+ return true;
+ }
+
+ /**
* Check if a user belongs to a group
*
* @param string $username Name of the user to check
diff --git a/lib/User/backend.php b/lib/User/backend.php
index 0483d72bf02..29a1932e193 100644
--- a/lib/User/backend.php
+++ b/lib/User/backend.php
@@ -38,6 +38,12 @@ abstract class OC_USER_BACKEND {
public static function createUser($username, $password){}
/**
+ * @brief Delete a new user
+ * @param $username The username of the user to delete
+ */
+ public static function deleteUser( $username ){}
+
+ /**
* Try to login a user
*
* @param string $username The username of the user to log in
diff --git a/lib/User/database.php b/lib/User/database.php
index f0b68cf17d7..5b68d3ff7c2 100644
--- a/lib/User/database.php
+++ b/lib/User/database.php
@@ -65,6 +65,18 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
}
/**
+ * Try to delete a user
+ *
+ * @param string $username The username of the user to delete
+ */
+ public static function deleteUser( $uid ){
+ $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE `uid` = ?" );
+ $result = $query->execute( array( $uid ));
+
+ return true;
+ }
+
+ /**
* Try to login a user
*
* @param string $username The username of the user to log in
diff --git a/lib/app.php b/lib/app.php
index c9e4d534357..19e6df77f84 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -318,7 +318,6 @@ class OC_APP{
* -# unzipping it
* -# including appinfo/installer.php
* -# executing "oc_app_install()"
- * -# renaming appinfo/app.sample.php to appinfo/app.php
*
* It is the task of oc_app_install to create the tables and do whatever is
* needed to get the app working.
@@ -346,8 +345,6 @@ class OC_APP{
* - pretend: boolean, if set true the system won't do anything
* - noupgrade: boolean, if true the function oc_app_upgrade will be
* skipped
- * - keepappinfo: boolean. If set true, the folder appinfo will not be
- * deleted, appinfo/app.php will not be replaced by a new version
*
* This function works as follows
* -# fetching the file
@@ -355,7 +352,6 @@ class OC_APP{
* -# unzipping new file
* -# including appinfo/installer.php
* -# executing "oc_app_upgrade( $options )"
- * -# renaming appinfo/app.sample.php to appinfo/app.php
*/
public static function upgradeApp( $data = array()){
// TODO: write function
diff --git a/lib/filestorage.php b/lib/filestorage.php
index e7fb9e9d270..799d07da9db 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -378,6 +378,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
}
public function fromTmpFile($tmpFile,$path){
+die( "oh nooo!" );
$fileStats = stat($tmpFile);
if(rename($tmpFile,$this->datadir.$path)){
touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']);
@@ -447,7 +448,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
}
return $return;
}
-
+
/**
* @brief get the size of folder and it's content
* @param string $path file path
@@ -462,7 +463,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
return $this->calculateFolderSize($path);
}
}
-
+
/**
* @brief calulate the size of folder and it's content and cache it
* @param string $path file path
@@ -493,7 +494,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
}
return $size;
}
-
+
/**
* @brief clear the folder size cache of folders containing a file
* @param string $path
diff --git a/lib/group.php b/lib/group.php
index 18e34c72773..d8a59a139a5 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -79,6 +79,24 @@ class OC_GROUP {
}
/**
+ * Try to create a new group
+ *
+ * @param string $groupName The name of the group to create
+ */
+ public static function createGroup($gid) {
+ return self::$_backend->createGroup($gid);
+ }
+
+ /**
+ * Try to delete Group
+ *
+ * @param string $groupName The name of the group to delete
+ */
+ public static function deleteGroup($gid) {
+ return self::$_backend->deleteGroup($gid);
+ }
+
+ /**
* Check if a user belongs to a group
*
* @param string $username Name of the user to check
diff --git a/lib/user.php b/lib/user.php
index d70443b7e61..6cfcc6be488 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -96,6 +96,14 @@ class OC_USER {
}
/**
+ * @brief Delete a new user
+ * @param $username The username of the user to delete
+ */
+ public static function deleteUser( $username ){
+ return self::$_backend->deleteUser( $username );
+ }
+
+ /**
* @brief try to login a user
* @param $username The username of the user to log in
* @param $password The password of the user