Local permissions / REST / write permission needed

Tuesday, 18 July 2017 · 5 messages · last reply 19 Jul 2017
FW
Florian Wagner18 Jul 2017 13:37 #
Hi everyone! Trying out BaseX I'm having problems getting a very simple setup to work correctly.
Quoted text · 1 line
> list
Name Resources Size Input Path ------------------------------------- test 2 33470 ~webdav 1 6004 2 database(s).
Quoted text · 1 line
> show users
Username Permission -------------------- admin admin test none 2 user(s).
Quoted text · 1 line
> show users on test
Username Permission -------------------- test write 1 user(s). $ curl -u test -i -X PUT -T file.xml http://host:8080/basex/rest/test/file.xml Enter host password for user 'test': HTTP/1.1 100 Continue HTTP/1.1 400 Bad Request Content-Type: text/plain;charset=utf-8 Content-Length: 24 Server: Jetty(9.3.9.v20160517) write permission needed. Using the "admin" user instead, works! Giving the test user global writer permissions makes it also work... So what am I doing wrong here? Regards Florian Wagner --- Universitaetsbibliothek Tuebingen Wilhelmstr. 32, 72074 Tuebingen IT-Abteilung, Raum B109 +49(0)7071/29-77860 http://www.ub.uni-tuebingen.de
CG
Christian Grün18 Jul 2017 13:53 #
Hi Florian, I’ve just tried to reproduce the behavior you’ve been describing. With my local instance, it works:
Quoted text · Florian Wagner · 1 line
> curl -u test "http://localhost:8984/rest/test/file.xml"
Enter host password for user 'test': <file/> Did you possibly create the user in a separate BaseX instance? If you have started the BaseX server, and if you have created the user via a single local BaseX instance, the settings might not have been adopted by a BaseX HTTP server instance. You can e.g. verify this by using the basexclient:
Quoted text · Florian Wagner · 1 line
>basexclient -U test -c "show users on test"
Password: Username Permission -------------------- test write Hope this helps, Christian
Quoted text · Florian Wagner · 56 lines
On Tue, Jul 18, 2017 at 1:37 PM, Florian Wagner <fl.wagner at uni-tuebingen.de> wrote: > Hi everyone! > > Trying out BaseX I'm having problems getting a very simple setup to > work correctly. > > > list > Name Resources Size Input Path > ------------------------------------- > test 2 33470 > ~webdav 1 6004 > > 2 database(s). > > > show users > Username Permission > -------------------- > admin admin > test none > > 2 user(s). > > > show users on test > Username Permission > -------------------- > test write > > 1 user(s). > > $ curl -u test -i -X PUT -T file.xml http://host:8080/basex/rest/test/file.xml > Enter host password for user 'test': > HTTP/1.1 100 Continue > > HTTP/1.1 400 Bad Request > Content-Type: text/plain;charset=utf-8 > Content-Length: 24 > Server: Jetty(9.3.9.v20160517) > > write permission needed. > > > Using the "admin" user instead, works! Giving the test user global > writer permissions makes it also work... > > So what am I doing wrong here? > > > Regards > Florian Wagner > --- > Universitaetsbibliothek Tuebingen > Wilhelmstr. 32, 72074 Tuebingen > IT-Abteilung, Raum B109 > +49(0)7071/29-77860 > http://www.ub.uni-tuebingen.de
FW
Florian Wagner18 Jul 2017 14:28 #
Quoted text · Christian Grün · 10 lines
On Tue, 18 Jul 2017 13:53:09 +0200 Christian Grün <christian.gruen at gmail.com> wrote: > Hi Florian, > > I’ve just tried to reproduce the behavior you’ve been describing. With > my local instance, it works: > > > curl -u test "http://localhost:8984/rest/test/file.xml" > Enter host password for user 'test': > <file/>
I can download the file without problems if I upload it using WebDAV or the admin user first. It's just PUTing it there that doesn't work!
Quoted text · Christian Grün · 5 lines
> Did you possibly create the user in a separate BaseX instance? If you > have started the BaseX server, and if you have created the user via a > single local BaseX instance, the settings might not have been adopted > by a BaseX HTTP server instance. You can e.g. verify this by using > the basexclient:
I'm running BaseX in Jetty and have added the users and permissions using the DBA. On startup it clearly logs where it get's its data from: +> Initparams o.e.j.w.WebAppContext@1a968a59{/basex,file:///tmp/jetty-0.0.0.0-8080-BaseX864.war-_basex-any-5617794070525242464.dir/webapp/,AVAILABLE}{/BaseX.war} +- org.basex.repopath=/var/db/basex/repo +- org.basex.dbpath=/var/db/basex/data +- org.basex.restpath=/var/db/basex/rest And /var/db/basex/data/users.xml contains my user.
  ...
  <user name="test" permission="none">
    <password algorithm="digest">
      <hash>...</hash>
    </password>
    <password algorithm="salted-sha256">
      <salt>...</salt>
      <hash>...</hash>
    </password>
    <database pattern="test" permission="write"/>
  </user>
  ...
Also there's another indication that this is the correct instance. I've changed the password of the admin user. If I upload with "curl -u admin ..." I have to enter the new one or it won't work. And one more: If I do "curl -u digi3f:WRONGPW ..." I get "Access denied" instead of "write permission needed". Any other ideas? Regards Florian Wagner --- Universitaetsbibliothek Tuebingen Wilhelmstr. 32, 72074 Tuebingen IT-Abteilung, Raum B109 +49(0)7071/29-77860 http://www.ub.uni-tuebingen.de
CG
Christian Grün19 Jul 2017 12:43 #
Hi Florian, Thanks for the added details. I managed to reproduce the behavior, and it should be fixed in the latest stable snapshot [1]. Could you give it a try? Cheers, Christian [1] http://files.basex.org/releases/latest/
Quoted text · Florian Wagner · 66 lines
On Tue, Jul 18, 2017 at 2:28 PM, Florian Wagner <fl.wagner at uni-tuebingen.de> wrote: > On Tue, 18 Jul 2017 13:53:09 +0200 > Christian Grün <christian.gruen at gmail.com> wrote: > >> Hi Florian, >> >> I’ve just tried to reproduce the behavior you’ve been describing. With >> my local instance, it works: >> >> > curl -u test "http://localhost:8984/rest/test/file.xml" >> Enter host password for user 'test': >> <file/> > > I can download the file without problems if I upload it using WebDAV or > the admin user first. It's just PUTing it there that doesn't work! > > >> Did you possibly create the user in a separate BaseX instance? If you >> have started the BaseX server, and if you have created the user via a >> single local BaseX instance, the settings might not have been adopted >> by a BaseX HTTP server instance. You can e.g. verify this by using >> the basexclient: > > I'm running BaseX in Jetty and have added the users and permissions > using the DBA. On startup it clearly logs where it get's its data from: > > +> Initparams > o.e.j.w.WebAppContext@1a968a59{/basex,file:///tmp/jetty-0.0.0.0-8080-BaseX864.war-_basex-any-5617794070525242464.dir/webapp/,AVAILABLE}{/BaseX.war} > +- org.basex.repopath=/var/db/basex/repo +- > org.basex.dbpath=/var/db/basex/data +- > org.basex.restpath=/var/db/basex/rest > > And /var/db/basex/data/users.xml contains my user. > > ... > <user name="test" permission="none"> > <password algorithm="digest"> > <hash>...</hash> > </password> > <password algorithm="salted-sha256"> > <salt>...</salt> > <hash>...</hash> > </password> > <database pattern="test" permission="write"/> > </user> > ... > > Also there's another indication that this is the correct instance. I've > changed the password of the admin user. If I upload with "curl -u > admin ..." I have to enter the new one or it won't work. > > And one more: If I do "curl -u digi3f:WRONGPW ..." I get "Access > denied" instead of "write permission needed". > > Any other ideas? > > > Regards > Florian Wagner > --- > Universitaetsbibliothek Tuebingen > Wilhelmstr. 32, 72074 Tuebingen > IT-Abteilung, Raum B109 > +49(0)7071/29-77860 > http://www.ub.uni-tuebingen.de
FW
Florian Wagner19 Jul 2017 15:53 #
Quoted text · Christian Grün · 7 lines
On Wed, 19 Jul 2017 12:43:31 +0200 Christian Grün <christian.gruen at gmail.com> wrote: > Hi Florian, > > Thanks for the added details. I managed to reproduce the behavior, and > it should be fixed in the latest stable snapshot [1]. Could you give > it a try?
Yes, that one works as expected! Thanks Florian Wagner --- Universitaetsbibliothek Tuebingen Wilhelmstr. 32, 72074 Tuebingen IT-Abteilung, Raum B109 +49(0)7071/29-77860 http://www.ub.uni-tuebingen.de

⚡Generated with XQuery