Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

How to set permission on the "/" directory for WebDAV Server #496

Closed
guru2228 opened this issue Jul 10, 2015 · 6 comments
Closed

How to set permission on the "/" directory for WebDAV Server #496

guru2228 opened this issue Jul 10, 2015 · 6 comments

Comments

@guru2228
Copy link

Hi,

I am setting up the Project on our Dev Environment using Roxy. We use Oxygen XML Developer as the Development tool. I have defined the developer role in the ml-config.xml. The developer is able to connect to the database in Oxygen but not able to access WebDAV . I found in the MarkLogic Knowledge base that we have Set Permission on the "/" directory.

https://help.marklogic.com/Knowledgebase/Article/View/252/0/read-only-access-user-for-webdav

So please help me how to configure the WebDAV with Permission on the "/" directory
Here is the WebDAV configuration for the modules DB

capture

@dmcassel
Copy link
Collaborator

When you say the developer role is not able to access WebDAV, do you mean they can connect but don't see anything? That might be a matter of permissions, but also make sure you set the database's directory creation to automatic. (Note that changing that setting on an existing database may not solve your problem.) Roxy defaults to manual directory creation. This matters because having URIs that start with "/" does not guarantee that you have a "/" directory. Try running xdmp:directory-create() in Query Console, specifying the permissions you need. If it doesn't throw XDMP-DIREXISTS, that was likely the problem.

@guru2228
Copy link
Author

Yes the developers able to connect but they are not able to see any thing.It just gives 404. Also the directory creation for Modules Database is Automatic where as Content database is Manual. Here we are exposing our Modules Database in the WebDav for Development.

But after running the below Query in the Query Console. They are able to see the files in WebDav for Modules DB

xdmp:document-add-permissions("/",xdmp:permission("Read_only_Access","read"))

xdmp:document-add-permissions("/",xdmp:permission("Write_only_Access",("read", "insert","execute","update"))

@dmcassel
Copy link
Collaborator

Seems reasonable to do that while setting up the modules database. We'd welcome a pull request, or for the short term, you could implement that as a custom command.

@grtjn
Copy link
Contributor

grtjn commented Jul 13, 2015

Perhaps adding something like this to app_specific.rb helps:

  alias_method :original_deploy_src, :deploy_src
  def deploy_src()
    original_deploy_src

    # change module permissions
    r = execute_query %Q{
      xquery version "1.0-ml";

      for $uri in cts:uris()
      return (
        $uri,
        xdmp:document-set-permissions($uri, (
          xdmp:permission("#{@properties["ml.app-name"]}-read-role", "read"),
          xdmp:permission("#{@properties["ml.app-name"]}-execute-role", "execute")
        ))
      )
    },
    { :db_name => @properties["ml.modules-db"] }
  end

@guru2228
Copy link
Author

Thank you for the inputs. I will implement and test it

@grtjn
Copy link
Contributor

grtjn commented Jun 14, 2017

Considering if there is anything we could change in Roxy to make this easier, but can't think of anything. Modules has directory-creation set to automatic by default in Roxy, and we always apply doc-permissions for at least app-role. That should be sufficient out of the box.

Closing this ticket.

@grtjn grtjn closed this as completed Jun 14, 2017
@grtjn grtjn self-assigned this Jun 14, 2017
@grtjn grtjn added this to the July 2017 milestone Jun 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants