aboutsummaryrefslogtreecommitdiffstats
path: root/apps/calendar/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <ownclouddev@georgswebsite.de>2012-02-22 10:41:16 +0100
committerGeorg Ehrke <ownclouddev@georgswebsite.de>2012-02-22 10:41:16 +0100
commit48f42176cdc1d75f2b9cd7b5c6d0cc4ee9050ced (patch)
tree5440fb3beae43fe85090c52e670899c1fb9c9e7e /apps/calendar/lib
parentd20b8399c395605da8a5c908c21963f1f4bdca97 (diff)
downloadnextcloud-server-48f42176cdc1d75f2b9cd7b5c6d0cc4ee9050ced.tar.gz
nextcloud-server-48f42176cdc1d75f2b9cd7b5c6d0cc4ee9050ced.zip
add is_editing_allowed function to OC_Calendar_Share
Diffstat (limited to 'apps/calendar/lib')
-rw-r--r--apps/calendar/lib/share.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index 621ff8ce217..a5ca0a6e738 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -181,4 +181,21 @@ class OC_Calendar_Share{
}
return $active_where;
}
+ /*
+ * @brief: checks the permission for editing an event
+ * @param: (string) $share - userid (if $sharetype == user) / groupid (if $sharetype == group) / token (if $sharetype == public)
+ * @param: (string) $id - id of the calendar / event
+ * @param: (string) $type - use const self::CALENDAR or self::EVENT
+ * @return (bool)
+ */
+ public static function is_editing_allowed($share, $id, $type){
+ $group_where = self::group_sql(OC_Group::getUserGroups($share));
+ $permission_where = self::permission_sql('rw');
+ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') ' . $permission_where . ')');
+ $result = $stmt->execute(array($share));
+ if($result->numRows() == 1){
+ return true;
+ }
+ return false;
+ }
} \ No newline at end of file