add some doc for lib/subadmin.php

This commit is contained in:
Georg Ehrke 2012-07-19 16:43:46 +02:00
parent 2fc834230a
commit 05bc541276
1 changed files with 14 additions and 1 deletions

View File

@ -101,7 +101,9 @@ class OC_SubAdmin{
/** /**
* @brief checks if a user is a SubAdmin of a group * @brief checks if a user is a SubAdmin of a group
* @return array * @param $uid uid of the subadmin
* @param $gid gid of the group
* @return bool
*/ */
public static function isSubAdminofGroup($uid, $gid){ public static function isSubAdminofGroup($uid, $gid){
$stmt = OC_DB::prepare('SELECT COUNT(*) as count FROM *PREFIX*group_admin where uid = ? AND gid = ?'); $stmt = OC_DB::prepare('SELECT COUNT(*) as count FROM *PREFIX*group_admin where uid = ? AND gid = ?');
@ -113,6 +115,11 @@ class OC_SubAdmin{
return false; return false;
} }
/**
* @brief checks if a user is a SubAdmin
* @param $uid uid of the subadmin
* @return bool
*/
public static function isSubAdmin($uid){ public static function isSubAdmin($uid){
$stmt = OC_DB::prepare('SELECT COUNT(*) as count FROM *PREFIX*group_admin WHERE uid = ?'); $stmt = OC_DB::prepare('SELECT COUNT(*) as count FROM *PREFIX*group_admin WHERE uid = ?');
$result = $stmt->execute(array($uid)); $result = $stmt->execute(array($uid));
@ -123,6 +130,12 @@ class OC_SubAdmin{
return false; return false;
} }
/**
* @brief checks if a user is a accessible by a subadmin
* @param $subadmin uid of the subadmin
* @param $user uid of the user
* @return bool
*/
public static function isUserAccessible($subadmin, $user){ public static function isUserAccessible($subadmin, $user){
if(!self::isSubAdmin($subadmin)){ if(!self::isSubAdmin($subadmin)){
return false; return false;