Help with understanding collections and user management

Tuesday, 28 February 2017 · 2 messages
K
kalibuk28 Feb 2017 09:43 #

Hallo, I have few questions while trying to get used to and use BaseX database in our solution.

A) Could be empty collection in a database created? This query db:add("MyDBName","","/NewCollectionName") perforemed in GUI creates collection NewCollectionName but copies there also bunch of other things used as example…

I tried also to ADD a xml file to NewCollection which works , new collection was created, but when I deleted that file, collection disappered also !

B) Is it possible to grant various users different access rights to different collections under one database ? Eg. granting access rights to groups of users and/or creating roles ?

Regards and thanks for your good job,

Jan Matuszek

CG
Christian Grün28 Feb 2017 10:45 #

Hi Jan,

Welcome to the list (glad to hear the registration finally worked out).

Quoted text · kalibuk · 4 lines
> A) Could be empty collection in a database created? This query > db:add("MyDBName","","/NewCollectionName") perforemed in GUI creates > collection NewCollectionName but copies there also bunch of other things > used as example…

In BaseX, all collections are of implicit nature: A collection will automatically be created once you add a file as resource to the collection path or name. If you address a collection without contents, you will simply get no results:

* Create database with initial document: db:create('db', <x/>, 'collection1/input.xml')

* Return all documents in the specified collection: db:open('db', 'collection1')

Quoted text · kalibuk · 3 lines
> B) Is it possible to grant various users different access rights to > different collections under one database ? Eg. granting access rights to > groups of users and/or creating roles ?

Access rights can only be granted to databases. However, databases are very light-weight in BaseX, so the usual modus operandi is to create multiple databases, which can all be addressed by a single XQuery expression.

See http://docs.basex.org/wiki/Databases for more information.

Hope this helps, Christian


⚡Generated with XQuery