]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into sharing_mail_notification_master
authorBjoern Schiessle <schiessle@owncloud.com>
Mon, 23 Sep 2013 09:18:00 +0000 (11:18 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Mon, 23 Sep 2013 09:18:00 +0000 (11:18 +0200)
Conflicts:
lib/public/share.php

1  2 
apps/files/index.php
core/js/share.js
db_structure.xml
lib/public/share.php

Simple merge
Simple merge
Simple merge
index 759848488ad9b047aace1ec44488aee3bc00525c,91b0ef6dc695dd2ee1a436ffddc486c19338e5ab..0dfbbef0a731904161bc33690d3c3846bd3a5ce2
@@@ -257,56 -257,6 +257,55 @@@ class Share 
                        $parameters, 1, $includeCollections);
        }
  
 +      /**
 +       * @brief Get the item of item type shared with a given user by source
 +       * @param string Item type
 +       * @param string Item source
 +       * @param string User user to whom the item was shared
 +       * @return Return list of items with file_target, permissions and expiration
 +       */
 +      public static function getItemSharedWithUser($itemType, $itemSource, $user) {
 +
 +              $shares = array();
 +
 +              // first check if there is a db entry for the specific user
 +              $query = \OC_DB::prepare(
 +                              'SELECT `file_target`, `permissions`, `expiration`
 +                                      FROM
 +                                      `*PREFIX*share`
 +                                      WHERE
 +                                      `item_source` = ? AND `item_type` = ? AND `share_with` = ?'
 +                              );
 +
 +              $result = $query->execute(array($itemSource, $itemType, $user));
 +
 +              while ($row = $result->fetchRow()) {
 +                      $shares[] = $row;
 +              }
 +
 +              //if didn't found a result than let's look for a group share.
 +              if(empty($shares)) {
 +                      $groups = \OC_Group::getUserGroups($user);
 +
 +                      $query = \OC_DB::prepare(
 +                                      'SELECT `file_target`, `permissions`, `expiration`
 +                                              FROM
 +                                              `*PREFIX*share`
 +                                              WHERE
 +                                              `item_source` = ? AND `item_type` = ? AND `share_with` in (?)'
 +                                      );
 +
 +                      $result = $query->execute(array($itemSource, $itemType, implode(',', $groups)));
 +
 +                      while ($row = $result->fetchRow()) {
 +                              $shares[] = $row;
 +                      }
 +              }
 +
 +              return $shares;
 +
 +      }
 +
        /**
        * @brief Get the item of item type shared with the current user by source
        * @param string Item type