Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add calendar sharing #21964

Merged
merged 9 commits into from
Feb 4, 2016
Merged

Add calendar sharing #21964

merged 9 commits into from
Feb 4, 2016

Conversation

DeepDiver1975
Copy link
Member

Test Scenario

  1. create a calendar (./occ dav:create-calendar user shared-calendar)
  2. POST a sharing xml request to the calendar url https://github.com/owncloud/core/blob/calendar-sharing-3/apps/dav/tests/travis/caldavtest/data/Resource/CalDAV/sharing/calendars/read-write/1.xml
  3. see the calendar popping up with the other user

You can use cadaver to check for the calendar resources.

@DeepDiver1975 DeepDiver1975 added this to the 9.0-current milestone Jan 27, 2016
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @schiesbn, @nickvergessen, @blizzz and @DeepDiver1975 to be potential reviewers

@DeepDiver1975 DeepDiver1975 force-pushed the calendar-sharing-3 branch 2 times, most recently from 0dcdb3d to 3f88c20 Compare January 28, 2016 09:03
@DeepDiver1975 DeepDiver1975 mentioned this pull request Jan 28, 2016
1 task
@georgehrke
Copy link
Contributor

The response body for the post request is empty and the response code a 200. Shouldn't it be a 204 instead?

If I share a calendar with a user and a group the user is also a member of the calendar appears twice:

Listing collection `/remote.php/dav/calendars/user3/': succeeded.
Coll:   inbox                                  0  Jan  1  1970
Coll:   outbox                                 0  Jan  1  1970
Coll:   uni_shared_by_user1                    0  Jan  1  1970
Coll:   uni_shared_by_user1                    0  Jan  1  1970
dav:/remote.php/dav/calendars/user3/>

@georgehrke
Copy link
Contributor

deleting events succeeds in a read-only calendar.

@DeepDiver1975
Copy link
Member Author

If I share a calendar with a user and a group the user is also a member of the calendar appears twice:

thx - note to self: use distinct

@DeepDiver1975
Copy link
Member Author

deleting events succeeds in a read-only calendar.

I'll have a look - THX

@georgehrke
Copy link
Contributor

deleting events succeeds in a read-only calendar.

I used <CS:read/>. Is that actually the right thing to do?

@DeepDiver1975
Copy link
Member Author

I used CS:read/. Is that actually the right thing to do?

by default sharing is read only - you have to add CS:read-write/ to share it writable

@DeepDiver1975
Copy link
Member Author

@georgehrke your issues should be addressed now - thanks for testing!

list(, $name) = URLUtil::splitPath($row['principaluri']);
$uri = $row['uri'] . '_shared_by_' . $name;
$row['displayname'] = $row['displayname'] . "($name)";
$readOnly = ($row['access'] == Backend::ACCESS_READ);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment to the code on why you only use == instead of ===

@georgehrke
Copy link
Contributor

Awesome, will retest asap.
Do you have XML examples for unsharing and updating permission for me?

@@ -153,10 +172,63 @@ function getCalendarsForUser($principalUri) {
$calendar[$xmlName] = $row[$dbName];
}

$calendars[] = $calendar;
$calendars[$calendar['id']] = $calendar;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DeepDiver1975
Copy link
Member Author

Do you have XML examples for unsharing and updating permission for me?

unshare

<?xml version="1.0" encoding="utf-8" ?>
<CS:share xmlns:D="DAV:" xmlns:CS="http://owncloud.org/ns">
    <CS:remove>
        <D:href>principal:principals/users/user02</D:href>
    </CS:remove>
</CS:share>

@DeepDiver1975
Copy link
Member Author

Updating permissions is done by just POSTing the set xml again

@DeepDiver1975
Copy link
Member Author

Will the user the calendar is shared with end up with a read-only or a read-write calendar?

this will all happen via the acls which are generated based on the shares which are attached to the calendar. These acls contain e.g. write privilege for the user and read for the group.

As soon as a write operation is issued on the calendar alls acl entires are evaluated.

So this should work already properly - I'll remove the access property within getCalendarsForUser.

$this->db = $db;
$this->principalBackend = $principalBackend;
$this->sharingBackend = new Backend($this->db, 'calendar');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no DI necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at rest of the code it's ok

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really from my pov since this is there to share common code between the two backends

but I'm happy to discuss this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I did not miss anything, they were onliners in methods, without further logic, so per se it's sufficient to test the Backend itself. OTOH it leaves a heritage, if the code would change in future.

@DeepDiver1975
Copy link
Member Author

delete has been fixed

@DeepDiver1975
Copy link
Member Author

How can I query a list of all sharees?

we have to implement something like https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing.txt#L396

@georgehrke
Copy link
Contributor

IMHO this is ready to be merged once the CS:invite property was taken care of

@DeepDiver1975
Copy link
Member Author

@georgehrke please have a look

@georgehrke
Copy link
Contributor

Roger that!

@georgehrke
Copy link
Contributor

user1 shared the calendar owncloud with group group1. user3 is a member of group1

dav:/remote.php/dav/calendars/user3/> ls
Listing collection `/remote.php/dav/calendars/user3/': succeeded.
Coll:   inbox                                  0  Jan  1  1970
Coll:   outbox                                 0  Jan  1  1970
Coll:   owncloud_shared_by_user1               0  Jan  1  1970
dav:/remote.php/dav/calendars/user3/> rmcol owncloud_shared_by_user1
Deleting collection `owncloud_shared_by_user1': succeeded.
dav:/remote.php/dav/calendars/user3/> ls
Listing collection `/remote.php/dav/calendars/user3/': succeeded.
Coll:   inbox                                  0  Jan  1  1970
Coll:   outbox                                 0  Jan  1  1970
Coll:   owncloud_shared_by_user1               0  Jan  1  1970
dav:/remote.php/dav/calendars/user3/>

It seems to respond with a success message, it should return an error code instead.

@georgehrke
Copy link
Contributor

I think the behavior that user3 can't unshare the calendar for all members of group1 is correct though.

@DeepDiver1975
Copy link
Member Author

Since the share operation works on a list of people to be shared and unshared with error feedback does not really exist ..... anyway - let's see

What would be the appropriate status code? 403/Forbidden ?

@georgehrke
Copy link
Contributor

What would be the appropriate status code? 403/Forbidden ?

Yes, 403 sounds just about right.

@DeepDiver1975
Copy link
Member Author

@georgehrke ...

@georgehrke
Copy link
Contributor

Deleting a calendar still leaves dead entries in oc_dav_shares

@georgehrke
Copy link
Contributor

looks good otherwise

@georgehrke
Copy link
Contributor

👍

@georgehrke
Copy link
Contributor

@blizzz could you review again? :)

@LukasReschke
Copy link
Member

Works 👍

DeepDiver1975 added a commit that referenced this pull request Feb 4, 2016
@DeepDiver1975 DeepDiver1975 merged commit e64044d into master Feb 4, 2016
@DeepDiver1975 DeepDiver1975 deleted the calendar-sharing-3 branch February 4, 2016 09:48
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants