diff options
author | Georg Ehrke <ownclouddev@georgswebsite.de> | 2012-02-21 20:10:52 +0100 |
---|---|---|
committer | Georg Ehrke <ownclouddev@georgswebsite.de> | 2012-02-21 20:10:52 +0100 |
commit | 3d8d6d718b65a972648ce7678cda13b2e1117272 (patch) | |
tree | 7320ef16f173ee3b87a38a47987e6e69cea23729 /apps | |
parent | 236d2aa5b8d1cf7700d2996b11ec8e3bd4c153c3 (diff) | |
download | nextcloud-server-3d8d6d718b65a972648ce7678cda13b2e1117272.tar.gz nextcloud-server-3d8d6d718b65a972648ce7678cda13b2e1117272.zip |
add 'permissions' as a sql condition in allSharedwithuser
Diffstat (limited to 'apps')
-rw-r--r-- | apps/calendar/lib/share.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php index d66095b9771..be2b440c647 100644 --- a/apps/calendar/lib/share.php +++ b/apps/calendar/lib/share.php @@ -17,7 +17,7 @@ class OC_Calendar_Share{ * @param: (string) $type - use const self::CALENDAR or self::EVENT * @return: (array) $return - information about calendars */ - public static function allSharedwithuser($userid, $type, $active=null){ + public static function allSharedwithuser($userid, $type, $active=null, $permission=null){ $group_where = ''; $groups = OC_Group::getUserGroups($userid); $i = 0; @@ -30,7 +30,12 @@ class OC_Calendar_Share{ $group_where .= ' (share = \'' . $group . '\' AND sharetype = \'group\') '; $i++; } - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = \'user\') ' . $group_where . ') AND owner <> ?' . ((!is_null($active) && $active)?' AND active = 1)':')')); + $permission_where = ''; + if(!is_null($permission)){ + $permission_where = 'AND permissions = '; + $permission_where .= ($permission=='rw')?'1':'0'; + } + $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = \'user\') ' . $group_where . ') AND owner <> ? ' . $permission_where . ' ' . ((!is_null($active) && $active)?' AND active = 1)':')')); $result = $stmt->execute(array($userid, $userid)); $return = array(); while( $row = $result->fetchRow()){ |