Skip to content

Share API

Michael Gapczynski edited this page Jul 8, 2013 · 13 revisions

Overview

The Share API is designed for sharing content between users in ownCloud

Definitions

  • Share - a connection that grants access to some type of content to someone
  • Share With - the person/people shared with e.g. user, group
  • Share Owner - a user who creates a share
  • Share Type - the type of share with e.g. user , group, link, email address
  • Item - a resource e.g. test.txt (file), Birthdays (calendar), Coworkers (addressbook)
  • Item Type - the type of item e.g. file, calendar, addressbook
  • Item Owner - the user that owns the item, may be different from the share owner
  • Item Source - the identifier of the resource used by the app
  • Item Target - the name of the resource for the share with
  • Reshare - a share in which a recipient of a share shares that item to a different share with
  • Parent Share - the share that is the parent of another share i.e. a reshare
  • CRUDS - create, read, update, delete, share permissions defined in lib/public/constants.php
  • Collection - an item type that can have children items to share e.g. folder (files), calendar (events)

Components

Share: Data holder for a share

Properties: Id, Parent Ids, Share Type Id, Share Owner, Share With, Item Type, Item Source, Item Target, Item Owner, Permissions, Expiration Time, Share Time, Token, Password

Shares: Backend class that apps extend and register with the SharesManager to share content. Apps must implement getItemType, isValidItem, and generateItemTarget. It represents a certain type of item for an app. Share types are passed into the constructor to provide storage for the shares.

SharesManager: This is the gateway for sharing content between users in ownCloud. The SharesManager's primary purpose is to ensure consistency between shares and their reshares.

ShareType: Interface that defines the responsibilities for a share type such as inserting, updating, and deleting shares from the database. A common share type class implements this interface and is extended by other share types to define their conditions for a valid share and additional custom handling.

ShareFactory: Maps database rows to a Share object

AdvancedShareFactory: Same as the ShareFactory, but also provides the share types with information about the item type's own database structure. For example, it can do a JOIN with the file cache table to grab all the file info in a single query.