[Bug 17505] New: REST API: Add route for messaging preferences

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] New: REST API: Add route for messaging preferences

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

            Bug ID: 17505
           Summary: REST API: Add route for messaging preferences
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Web services
          Assignee: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

REST API: Add route for messaging preferences

--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

Lari Taskula <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|[hidden email]-commun |[hidden email]
                   |ity.org                     |

--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

Lari Taskula <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |17499


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499
[Bug 17499] Koha objects for messaging preferences
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

Mike <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         QA Contact|[hidden email]-communit |
                   |y.org                       |
           Assignee|[hidden email]         |[hidden email]
                 CC|                            |[hidden email]

Jiri Kozlovsky <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |In Discussion

--- Comment #1 from Jiri Kozlovsky <[hidden email]> ---
Just to be clear about the implementation details ..

For messaging preferences to work, there must be set
EnhancedMessagingPreferences to Allow in order to let anyone change anything.
This will ensure only staff can edit messaging preferences. For regular users
to allow them editing those,  EnhancedMessagingPreferencesOPAC must be also
enabled. If is  EnhancedMessagingPreferencesOPAC enabled, but
EnhancedMessagingPreferences is not, no editing is allowed to anyone.

API URL will be in this format: /api/v1/messaging_preferences/{borrowernumber}

Next, I suppose, there will be GET & POST methods. No else.

GET method only returns user's messaging prefs. User can view only it's own
prefs, unless he has 'borrowers' rights.

POST method updates user's messaging pref. User can update only it's own prefs,
unless he has 'borrowers' rights.

Both, GET & POST methods will send / receive JSON in this format:
{
  item_due: { email: 0/1, digest_only: 0/1, do_not_notify: 0/1 }
  advance_notice: { days_in_advance: 0-30, email: 0/1, digest_only: 0/1,
do_not_notify: 0/1 }
  hold_filled: { email: 0/1, do_not_notify: 0/1 }
  item_checkin: { email: 0/1, do_not_notify: 0/1 }
  item_checkout: { email: 0/1, do_not_notify: 0/1 }
}

Please someone take a look at this concept, if it is okay to implement this
feature in this way.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #2 from Lari Taskula <[hidden email]> ---
Hey. Any update on this? I will start working on it if you haven't already. I
attached Koha-objects to Bug 17499 which could be useful for this one.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #3 from Jiri Kozlovsky <[hidden email]> ---
(In reply to Lari Taskula from comment #2)
> Hey. Any update on this? I will start working on it if you haven't already.
> I attached Koha-objects to Bug 17499 which could be useful for this one.

Hey there Lari. Yes, I've already done some work, but now I'm going to be away
from work on Koha until I finish final school exams for bachelor's degree.

If you want, you can take a look at the work & finish it ;) All the work is in
this single commit:
https://github.com/open-source-knihovna/KohaCZ/commit/7bddf4f709fce467296ddce814b4612aeaa00088

Basically I made it work for GET request. Feel free to change my coding style
as you wish :D

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #4 from Lari Taskula <[hidden email]> ---
(In reply to Jiri Kozlovsky from comment #3)

> (In reply to Lari Taskula from comment #2)
> > Hey. Any update on this? I will start working on it if you haven't already.
> > I attached Koha-objects to Bug 17499 which could be useful for this one.
>
> Hey there Lari. Yes, I've already done some work, but now I'm going to be
> away from work on Koha until I finish final school exams for bachelor's
> degree.
>
> If you want, you can take a look at the work & finish it ;) All the work is
> in this single commit:
> https://github.com/open-source-knihovna/KohaCZ/commit/
> 7bddf4f709fce467296ddce814b4612aeaa00088
>
> Basically I made it work for GET request. Feel free to change my coding
> style as you wish :D

Cheers! It looks awesome! I will integrate your work with mine, and attach a
patch here. Good luck with your exams!

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #5 from Mike <[hidden email]> ---
Hi Lari,
any progress on it? Jiri propably will ready to join us again and do some code
on REST. So, we need to know actual state of Your work.

Thank You.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #6 from Lari Taskula <[hidden email]> ---
(In reply to Mike from comment #5)
> Hi Lari,
> any progress on it? Jiri propably will ready to join us again and do some
> code on REST. So, we need to know actual state of Your work.
>
> Thank You.

Hi! Sorry for late answer, I was on holidays. Yes, I have some code ready,
attaching it by tomorrow so you can review it. Nice to hear Jiri is joining you
again!

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

Lari Taskula <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|In Discussion               |Needs Signoff

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #7 from Lari Taskula <[hidden email]> ---
Created attachment 64796
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64796&action=edit
Bug 17505: REST API route for messaging preferences

Get patron's / category's messaging preferences:
    GET /messaging_preferences?borrowernumber=123
        - allowed if getting own preferences
        - otherwise borrowers flag required
    GET /messaging_preferences?categorycode=K
        - borrowers flag required

Modify patron's / category's messaging preferences:
    PUT /messaging_preferences?borrowernumber=123
        - allowed if modifying own preferences
        - otherwise borrowers flag required

    PUT /messaging_preferences?categorycode=K
        - borrowers flag required

Returns the following JSON object (same for PUT except for readOnly values):
{
  "Advanced_Notice": {
    "days_in_advance": {
      "configurable": true,
      "value": 20
    },
    "digest": {
      "configurable": true,
      "value": true
    },
    "transport_types": {
      "email": true,
      "sms": false
    }
  },
  "Another_Message_Name": {
    "days_in_advance": {
      "configurable": false,
      "value": null
    },
    "digest": { ...
  },
  ...
}

To test:
1. prove t/db_dependent/api/v1/messagingpreferences.t
2. Send GET and PUT requests to /api/v1/messaging_preferences

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

Lari Taskula <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |18137

--- Comment #8 from Lari Taskula <[hidden email]> ---
Depends on Bug 18137 and 17499. These Bugs will conflict in Koha/Exceptions.pm
but should be easily fixable.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18137
[Bug 18137] REST API: Migrate from Mojolicious::Plugin::Swagger2 to
Mojolicious::Plugin::OpenAPI
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

Jiri Kozlovsky <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Signoff               |Patch doesn't apply

--- Comment #9 from Jiri Kozlovsky <[hidden email]> ---
(In reply to Lari Taskula from comment #8)
> Depends on Bug 18137 and 17499. These Bugs will conflict in
> Koha/Exceptions.pm but should be easily fixable.

I somehow cannot apply the patch, it shows following error:

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 17505: REST API route for messaging preferences
fatal: sha1 information is lacking or useless
(api/v1/swagger/definitions.json).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 17505: REST API route for messaging preferences
The copy of the patch that failed is found in:
   /home/vagrant/kohaclone/.git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in
/tmp/Bug-17505-REST-API-route-for-messaging-preferences-QwXcYD.patch

When trying to apply it manually using 'git apply
/home/vagrant/kohaclone/.git/rebase-apply/patch -3 -v', it also shows an error:

error: while searching for:
  "holds": {
    "$ref": "definitions/holds.json"
  },
  "patron": {
    "$ref": "definitions/patron.json"
  }

error: patch failed: api/v1/swagger/definitions.json:11
error: repository lacks the necessary blob to fall back on 3-way merge.
error: api/v1/swagger/definitions.json: patch does not apply

... Didn't you forgot to add another dependency? I've applied both 17499 &
18137 on top of current master.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 17505] REST API: Add route for messaging preferences

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17505

--- Comment #10 from Lari Taskula <[hidden email]> ---
The only dependencies are Bug 18137 and Bug 17499... Are you sure all patches
from Bug 18137 were applied? (Especially the "sort definitions.json"?) Because
otherwise I don't see why it has an issue in definitions.json... However Bug
18137 needs a rebase anyway since it conflicts in the Holds controller after
Bug 18276 and Bug 18260.

--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Loading...