Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-/PrivilegeManager #41

Closed
Metal-Frog opened this issue Oct 23, 2018 · 1 comment
Closed

User-/PrivilegeManager #41

Metal-Frog opened this issue Oct 23, 2018 · 1 comment

Comments

@Metal-Frog
Copy link

Metal-Frog commented Oct 23, 2018

Hi,
I'm stuck with the User-/PrivilegeManager.
This is my code:

const webdav = require('webdav-server').v2;

const userManager = new webdav.SimpleUserManager();
const userH = userManager.addUser('home', '111', false);
const userW = userManager.addUser('work', '111', false);

const privilegeManager = new webdav.SimplePathPrivilegeManager();
privilegeManager.setRights(userH, '/home', [ 'all' ]);
privilegeManager.setRights(userW, '/work', [ 'all' ]);

const server = new webdav.WebDAVServer({
    httpAuthentication: new webdav.HTTPDigestAuthentication(userManager, 'Default realm'),
    privilegeManager: privilegeManager
});

server.start(() => console.log('READY'));

Can someone help?

@AdrienCastex
Copy link
Member

Hello,

Sorry for the wait, I've been very busy.

Can you explain your problem please ?

Here is a sample based on yours which works:

const webdav = require('webdav').v2;

const userManager = new webdav.SimpleUserManager();
const userH = userManager.addUser('home', '111', false);
const userW = userManager.addUser('work', '111', false);

const privilegeManager = new webdav.SimplePathPrivilegeManager();
privilegeManager.setRights(userH, '/home', [ 'all' ]);
privilegeManager.setRights(userW, '/work', [ 'all' ]);

const server = new webdav.WebDAVServer({
    httpAuthentication: new webdav.HTTPDigestAuthentication(userManager, 'Default realm'),
    privilegeManager: privilegeManager
});

const fs = server.rootFileSystem();
fs.addSubTree(server.createExternalContext(), {
    home: webdav.ResourceType.Directory,
    work: webdav.ResourceType.Directory
});

server.start(() => console.log('READY'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants