~ubuntu-branches/ubuntu/quantal/lightning-extension/quantal-security

« back to all changes in this revision

Viewing changes to calendar/base/modules/calProviderUtils.jsm

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-01-12 15:28:46 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120112152846-ib27rzd0zldftoql
Tags: 1.2~b1+build1-0ubuntu1
* New upstream release from the beta channel (CALENDAR_1_2b1_BUILD1)
* Refresh debian/patches/01_no_sunbird.patch
* Bump maxVersion for lightning to 10.*, but drop changes to non-binary
  addons (gdata-provider / timezones) as these aren't needed anymore
  - update debian/patches/03_maxversion_override.patch
* Add some additional mailnews makefiles to the tarball, to make the build
  system not sad anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
556
556
 
557
557
    mID: null,
558
558
    mUri: null,
 
559
    mACLEntry: null,
559
560
    mObservers: null,
560
561
    mProperties: null,
561
562
 
619
620
        return this.setProperty("name", aValue);
620
621
    },
621
622
 
 
623
    // readonly attribute calICalendarACLManager aclManager;
 
624
    get aclManager() {
 
625
        const defaultACLProviderClass = "@mozilla.org/calendar/acl-manager;1?type=default";
 
626
        let providerClass = this.getProperty("aclManagerClass");
 
627
        if (!providerClass || !Components.classes[providerClass]) {
 
628
            providerClass = defaultACLProviderClass;
 
629
        }
 
630
        return Components.classes[providerClass].getService(Components.interfaces.calICalendarACLManager);
 
631
    },
 
632
 
 
633
    // readonly attribute calICalendarACLEntry aclEntry;
 
634
    get aclEntry() {
 
635
        return this.mACLEntry;
 
636
    },
 
637
 
622
638
    // attribute calICalendar superCalendar;
623
639
    get superCalendar() {
624
640
        // If we have a superCalendar, check this calendar for a superCalendar.
833
849
 
834
850
    // calISchedulingSupport: Implementation corresponding to our iTIP/iMIP support
835
851
    isInvitation: function cPB_isInvitation(aItem) {
836
 
        let id = this.getProperty("organizerId");
837
 
        if (id) {
838
 
            let org = aItem.organizer;
839
 
            if (!org || (org.id.toLowerCase() == id.toLowerCase())) {
840
 
                return false;
841
 
            }
842
 
            return (aItem.getAttendeeById(id) != null);
843
 
        }
 
852
        if (!this.mACLEntry || !this.mACLEntry.hasAccessControl) {
 
853
            // No ACL support - fallback to the old method
 
854
            let id = this.getProperty("organizerId");
 
855
            if (id) {
 
856
                let org = aItem.organizer;
 
857
                if (!org || (org.id.toLowerCase() == id.toLowerCase())) {
 
858
                    return false;
 
859
                }
 
860
                return (aItem.getAttendeeById(id) != null);
 
861
            }
 
862
            return false;
 
863
        }
 
864
 
 
865
        let org = aItem.organizer;
 
866
        if (!org) {
 
867
            // HACK
 
868
            // if we don't have an organizer, this is perhaps because it's an exception
 
869
            // to a recurring event. We check the parent item.
 
870
            if (aItem.parentItem) {
 
871
                org = aItem.parentItem.organizer;
 
872
                if (!org) return false;
 
873
            } else {
 
874
                return false;
 
875
            }
 
876
        }
 
877
 
 
878
        // We check if :
 
879
        // - the organizer of the event is NOT within the owner's identities of this calendar
 
880
        // - if the one of the owner's identities of this calendar is in the attendees
 
881
        let ownerIdentities = this.mACLEntry.getOwnerIdentities({});
 
882
        for (let i = 0; i < ownerIdentities.length; i++) {
 
883
            let identity = "mailto:" + ownerIdentities[i].email.toLowerCase();
 
884
            if (org.id.toLowerCase() == identity)
 
885
                return false;
 
886
 
 
887
            if (aItem.getAttendeeById(identity) != null)
 
888
                return true;
 
889
        }
 
890
 
844
891
        return false;
845
892
    },
846
893
 
847
894
    getInvitedAttendee: function cPB_getInvitedAttendee(aItem) {
848
895
        let id = this.getProperty("organizerId");
849
 
        return (id ? aItem.getAttendeeById(id) : null);
 
896
        let attendee = (id ? aItem.getAttendeeById(id) : null);
 
897
 
 
898
        if (!attendee && this.mACLEntry && this.mACLEntry.hasAccessControl) {
 
899
            let ownerIdentities = this.mACLEntry.getOwnerIdentities({});
 
900
            if (ownerIdentities.length > 0) {
 
901
                let identity;
 
902
                for (let i = 0; !attendee && i < ownerIdentities.length; i++) {
 
903
                    identity = "mailto:" + ownerIdentities[i].email.toLowerCase();
 
904
                    attendee = aItem.getAttendeeById(identity);
 
905
                }
 
906
            }
 
907
        }
 
908
 
 
909
        return attendee;
850
910
    },
851
911
 
852
912
    canNotify: function cPB_canNotify(aMethod, aItem) {