calendar/providers/wcap/public/calIWcapCalendar.idl
author Siddharth Agarwal <sid.bugzilla@gmail.com>
Mon, 27 Feb 2012 18:52:44 +0530
changeset 10952 f2fb318dd98befa2009d3b3f181ecaa907b052cc
parent 2631 b84ee56363187060a1e64bf88639c52b1833d1a8
child 12286 84ac3c71109811da751f0ef2d72108075938f094
permissions -rw-r--r--
Bug 721447 - Remove support for pre-Windows 7 SDKs (comm-central version). r=Standard8

/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Sun Microsystems code.
 *
 * The Initial Developer of the Original Code is
 *   Sun Microsystems, Inc.
 * Portions created by the Initial Developer are Copyright (C) 2007
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Daniel Boelzle <daniel.boelzle@sun.com>
 *   Philipp Kewisch <mozilla@kewis.ch>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "calICalendar.idl"
#include "calIDateTime.idl"
interface calIWcapSession;

/** Adds WCAP specific capabilities to calICalendar.
 */
[scriptable, uuid(21A189DF-6C92-41f6-9E2B-1929EF25CAEE)]
interface calIWcapCalendar : calICalendar
{
    /**
     * User session this calendar instance belongs to.
     */
    readonly attribute calIWcapSession session;

    /**
     * Current calId the calendar instance acts on; defaults to userId.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute string calId;

    /**
     * UserId of primary owner of this calendar instance.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute string ownerId;

    /**
     * Determines whether this calendar instance is the user's default calendar.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute boolean isDefaultCalendar;

    /**
     * Whether the currently selected calendar belongs to user.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute boolean isOwnedCalendar;

    /**
     * Calendar description.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute string description;

    /**
     * Calendar display name.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute string displayName;

    /**
     * Gets this calendar's (calId) default timezone.
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    readonly attribute string defaultTimezone;

    /**
     * Gets calendar properties.
     *
     * @param propName property name (e.g. X-S1CS-CALPROPS-COMMON-NAME)
     * @param count length of props array
     * @param listener called with array of strings as result
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     */
    void getCalendarProperties(in string propName,
                               out unsigned long count,
                               [array, size_is(count), retval] out string props);

    /* xxx todo: additional filters sensible for calICalendar, too?
                 claiming bits 24-30 for now.
                 
                 Those bits are somehow handled special now:
                 If at least one of the below is set, then
                 that filter bit(s) are active.
                 If none of the below is set, then those compstate
                 filters are not taken into account at all.
                 So there is no need to OR all of the below together
                 (ITEM_FILTER_ALL_ITEMS does not cover these bits) if you
                 don't care about the REQUEST/REPLY states.

       xxx todo: ITEM_FILTER_CLASS_OCCURRENCES is not filter, rename?
    */

    /* xxx todo: limit to currently needed ones: NEEDS-ACTION */

//     /**
//      * Scope: getItems only
//      * Whether getItems should only return items that have alarms set for the
//      * specified range.
//      */
//     const unsigned long ITEM_FILTER_BY_ALARM_RANGE = 1 << 23;

//     /**
//      * Scope: Attendee
//      * The event or todo is an invitation from another
//      * user and the current user has declined the invitation.
//      */
//     const unsigned long ITEM_FILTER_REPLY_DECLINED = 1 << 24;

//     /**
//      * Scope: Attendee
//      * The event or todo is an invitation from another
//      * user and the current user has accepted the invitation.
//      */
//     const unsigned long ITEM_FILTER_REPLY_ACCEPTED = 1 << 25;

//     /**
//      * Scope: Organizer
//      * The event or todo is an invitation from the current
//      * user to other invitees, and all invitees have replied.
//      */
//     const unsigned long ITEM_FILTER_REQUEST_COMPLETED = 1 << 26;

//     /**
//      * Scope: Attendee
//      * The event or todo is an invitation from another
//      * user and the current user has not replied to it yet.
//      */
//     const unsigned long ITEM_FILTER_REQUEST_NEEDS_ACTION = 1 << 27;

//     /**
//      * Scope: Attendee
//      * The event or todo is an invitation from another
//      * user and the current user is not required to reply.
//      */
//     const unsigned long ITEM_FILTER_REQUEST_NEEDSNOACTION  = 1 << 28;

//     /**
//      * Scope: Organizer
//      * The event or todo is an invitation from the current
//      * user to other invitees, and is currently in the
//      * process of sending out invitations.
//      */
//     const unsigned long ITEM_FILTER_REQUEST_PENDING = 1 << 29;

//     /**
//      * Scope: Organizer
//      * The event or todo is an invitation from the current
//      * user to other invitees, and is currently awaiting.
//      */
//     const unsigned long ITEM_FILTER_REQUEST_WAITFORREPLY = 1 << 30;

    /* xxx todo:
       separate out into another interface and leave only an attribute
       
       readonly attribute calIWcapAccessControl accessControl;

       here?
       This would bloat client code somehow like

       if (cal.accessControl &&
           cal.accessControl.check(calIAccessControl.AC_COMP_WRITE))
           cal.deleteItem(item, listener);

       but makes it easier for provider implementors not implementing the
       whole stuff...

       Right now, the below are similar to *nix fs rights, i.e. "write" includes
       "add", "delete" and "modify".
       Does it make sense to separate "add" and "delete" out of "write"?
    */

    /**
     * Whether it is allowed or denied to get availability information
     * (i.e. free-busy times).
     */
    const unsigned long AC_FREEBUSY = 1 << 0;

    /**
     * Whether it is allowed or denied to invite a calendar's
     * owner placing an invitation into the calendar.
     */
    const unsigned long AC_SCHEDULE = 1 << 1;

    /**
     * Whether it is allowed or denied to read components.
     */
    const unsigned long AC_COMP_READ = 1 << 2;

    /**
     * Whether it is allowed or denied to add, modify or delete components.
     */
    const unsigned long AC_COMP_WRITE = 1 << 3;

    /**
     * Whether it is allowed or denied to read properties.
     */
    const unsigned long AC_PROP_READ = 1 << 4;

    /**
     * Whether it is allowed or denied to add, modify or delete properties.
     */
    const unsigned long AC_PROP_WRITE = 1 << 5;

    /**
     * Full access, includes all of the above.
     */
    const unsigned long AC_FULL = (AC_FREEBUSY    |
                                   AC_SCHEDULE    |
                                   AC_COMP_READ   |
                                   AC_COMP_WRITE  |
                                   AC_PROP_READ   |
                                   AC_PROP_WRITE);

    /**
     * Checks whether the currently logged in user can perform the specified
     * actions. Clients should check these bits before performing operations
     * on a calendar instance, e.g.
     *
     * if (cal.checkAccess(calIWcapCalendar.AC_COMP_WRITE))
     *     cal.deleteItem(item, listener);
     *
     * or
     * 
     * if (cal.checkAccess(calIWcapCalendar.AC_PROP_WRITE))
     *     cal.name = newName;
     *
     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
     * @param accessControlBits access control bits (above AC_ definitions)
     * @return true if access is granted, false otherwise
     */
    boolean checkAccess(in unsigned long accessControlBits);

//     /**
//      * Defines granted and denied permissions for a specific user or
//      * user domain. Specific user entries precede over domain entries.
//      *
//      * Examples:
//      * a) Allow all users availability and read access,
//      *    but jdoe only availability access:
//      *    defineAccessControl("@", AC_FREEBUSY | AC_COMP_READ);
//      *    defineAccessControl("jdoe", AC_FREEBUSY);
//      *
//      * b) Restrict jdoe to have no access:
//      *    defineAccessControl("jdoe", 0);
//      *
//      * Follow-up definition calls for the same user will overwrite previous
//      * definitions.
//      * 
//      * @param userId user that is affected by the access control bits
//      *               WCAP specific:
//      *                    - @ stands in for everybody
//      *                    xxx todo: change the above
//      * @param accessControlBits access control bits (above AC_ definitions)
//      * @param listener called when access control bits have been updated
//      * @return optional object to track operation
//      */
//     calIOperation defineAccessControl(
//         in string userId, in unsigned long accessControlBits,
//         in calIGenericOperationListener listener);
    
//     /**
//      * To reset a user's access control definition to the default ones
//      * that everybody is granted.
//      * In case the user has no specific access control definition,
//      * Components.results.NS_ERROR_INVALID_ARG is thrown.
//      *
//      * @param userId user id
//      * @param listener called when access control bits have been updated
//      * @return optional object to track operation
//      */
//     calIOperation resetAccessControl(
//         in string userId,
//         in calIGenericOperationListener listener);
    
//     /**
//      * Gets the set of access control definitions (including "everybody").
//      * Both out arrays have the same length.
//      *
//      * @param count length of returned arrays
//      * @param users users ids
//      * @param accessControlBits access control bits
//      * @param listener called with xxx todo
//      * @return optional object to track operation
//      */
//     calIOperation getAccessControlDefinitions(
//         out unsigned long count,
//         [array, size_is(count)] out string users,
//         [array, size_is(count)] out unsigned long accessControlBits );
};