Add missing parameters to Permission related jobs and fix url typo.
ClosedPublic

Authored by barchiesi on Sep 15 2019, 10:03 PM.

Details

Summary

This patch adds missing parameters to Permission related Jobs, necessary for sending invitation emails and operating ad domain admin.

Diff Detail

Repository
R477 KGAPI Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
barchiesi created this revision.Sep 15 2019, 10:03 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptSep 15 2019, 10:03 PM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
barchiesi requested review of this revision.Sep 15 2019, 10:03 PM
barchiesi added a project: LibKGAPI.
barchiesi added a subscriber: LibKGAPI.
barchiesi updated this revision to Diff 66198.Sep 16 2019, 10:36 AM

Added missing derived class access-specifier to PermissionDeleteJob.

dvratil requested changes to this revision.Sep 16 2019, 12:39 PM

Nice, thanks for the patch.

I understand the desire to not sent unnecessary query parameters when they do not differ from the default value, but the way the code stands now it look like "magic" to me and is error prone - how about defining default value constants like e.g.

namespace {
static constexpr bool useDomainAdminAccessDefault = false;
}

and then all the conditions would look like

if (d->useDomainAdminAccess != useDomainAdminAccessDefault) {
   ...
}

Which I think is not only much easier to understand but also prevents mistakes like those below and makes changing the default super-easy (single place in the entire file).

src/drive/permissioncreatejob.cpp
101

This property defaults to false, so shouldn't the condition be the other way around, so it gets sent when it's different from the default?

src/drive/permissiondeletejob.cpp
136

This property defaults to false, so shouldn't the condition be the other way around, so it gets sent when it's different from the default?

src/drive/permissionmodifyjob.cpp
95

This property defaults to false, so shouldn't the condition be the other way around, so it gets sent when it's different from the default? Same below...

This revision now requires changes to proceed.Sep 16 2019, 12:39 PM
barchiesi updated this revision to Diff 66220.Sep 16 2019, 1:26 PM

That sounds like a better way of handling defaults, I'll keep it in mind when touching other Jobs.

dvratil requested changes to this revision.Sep 17 2019, 12:04 PM

Thanks for the fix. Could you also modify the constructors so that the class members are initialized using the fooDefault constants as well, so that we really only have a single place in the entire file where the default value is defined?

This revision now requires changes to proceed.Sep 17 2019, 12:04 PM
barchiesi updated this revision to Diff 66398.Sep 18 2019, 4:47 PM

Added parameter default values to member initialization.

@dvratil I rechecked if Permission was complete and added missing attributes. Also added an example.

barchiesi updated this revision to Diff 66399.Sep 18 2019, 4:51 PM

Remove debug info from permissions example.

dvratil requested changes to this revision.Sep 19 2019, 8:28 AM

Just minor nitpicks. Fix those and you can commit the patch. Thanks!

src/drive/permission.cpp
36

Should be initialized to PermissionType::UndefinedType

218

const QVariant & (or const auto &)

244–245

Just replace the initialization section with = default, please, since you are touching this :)

This revision now requires changes to proceed.Sep 19 2019, 8:28 AM
barchiesi updated this revision to Diff 66434.Sep 19 2019, 9:07 AM
barchiesi marked 3 inline comments as done.

Fixed minor nitpicks

This revision was not accepted when it landed; it landed in state Needs Review.Sep 19 2019, 9:09 AM
This revision was automatically updated to reflect the committed changes.