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

Check addressbook permission before moving #297

Merged
merged 7 commits into from
Aug 25, 2017

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Aug 22, 2017

Fix #174

Testing:

  1. Create an addressbook with another user in read only mode and share it with your current user.
  2. Try to move a contact to this addressbook.

@skjnldsv skjnldsv added 2. developing Work in progress bug Something isn't working high High priority labels Aug 22, 2017
@skjnldsv skjnldsv added this to the 2.0.0 milestone Aug 22, 2017
@skjnldsv skjnldsv self-assigned this Aug 22, 2017
@skjnldsv skjnldsv changed the title Fix correct addressbook owner Check addressbook permission before moving Aug 22, 2017
@skjnldsv skjnldsv force-pushed the check-if-move-to-ab-is-allowed branch from db6abc0 to 86a221b Compare August 22, 2017 16:11
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the check-if-move-to-ab-is-allowed branch from 86a221b to 8e2d679 Compare August 22, 2017 16:12
@codecov
Copy link

codecov bot commented Aug 22, 2017

Codecov Report

Merging #297 into master will decrease coverage by 0.08%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
- Coverage   14.82%   14.73%   -0.09%     
==========================================
  Files          55       55              
  Lines        1221     1228       +7     
==========================================
  Hits          181      181              
- Misses       1040     1047       +7
Impacted Files Coverage Δ
js/models/addressBook_model.js 4.34% <ø> (ø) ⬆️
js/services/contact_service.js 0.64% <0%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42451b3...fdea685. Read the comment docs.

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the check-if-move-to-ab-is-allowed branch 3 times, most recently from 60a7a56 to 69f8dbe Compare August 24, 2017 07:53
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the check-if-move-to-ab-is-allowed branch from 69f8dbe to 60cc140 Compare August 24, 2017 07:56
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 24, 2017
@@ -251,6 +251,10 @@ angular.module('contactsApp')
if (contact.addressBookId === addressbook.displayName) {
return;
}
if(addressbook.readOnly) {
OC.Notification.showTemporary(t('contacts', 'You don\'t have permission to write to this addressbook.'));
Copy link
Member

Choose a reason for hiding this comment

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

It should be 'You don't have permission to write to this addressbook.'

Copy link
Member Author

Choose a reason for hiding this comment

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

That's exactly what it's written. 😁

Copy link
Member Author

Choose a reason for hiding this comment

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

If you're talking about the \' it's to escape the ' character since we're using it to define the string. :)

@@ -1620,6 +1620,7 @@ var listAddressBooks = _co2['default'].wrap(regeneratorRuntime.mark(function cal
req = request.propfind({
props: [{ name: 'displayname', namespace: ns.DAV }, { name: 'owner', namespace: ns.DAV }, { name: 'getctag', namespace: ns.CALENDAR_SERVER }, { name: 'resourcetype', namespace: ns.DAV }, { name: 'sync-token', namespace: ns.DAV },
//{ name: 'groups', namespace: ns.OC },
{ name: 'read-only', namespace: ns.OC },
Copy link
Member Author

Choose a reason for hiding this comment

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

It's the only line I changed on this file, the rest is just Github failing to see I didn't changed anything else.... 😑

Copy link
Member

Choose a reason for hiding this comment

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

This is compiled code. I'm quite sure you shouldn't change it here, but in js/dav/lib/contacts.js and then run make in js/dav.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh you're right! :O

In case if the default addressbook is in read only mode

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@irgendwie
Copy link
Member

Works and is ok for now - we need to push a new release 👍
For the future, I'd like to remove read-only addressbooks from the addressbook selection in the details and for contacts of such an addressbook a not editable field.

@irgendwie irgendwie merged commit a5e96ab into master Aug 25, 2017
@irgendwie irgendwie deleted the check-if-move-to-ab-is-allowed branch August 25, 2017 11:48
@skjnldsv
Copy link
Member Author

@irgendwie look #294 too :)

skjnldsv added a commit that referenced this pull request Aug 26, 2017
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
skjnldsv added a commit that referenced this pull request Aug 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working high High priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants