Skip to content

Commit

Permalink
The user used by the 'createExternal(...)' static method of the 'Requ…
Browse files Browse the repository at this point in the history
…estContext' class is now a super-admin user unreferenced by the user manager
  • Loading branch information
AdrienCastex committed Jun 29, 2017
1 parent d81a883 commit 50e1194
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/server/v2/RequestContext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export declare class DefaultRequestContextExternalOptions implements RequestCont
[name: string]: string;
};
url: string;
user: IUser;
}
export declare class RequestContext {
server: WebDAVServer;
Expand Down
11 changes: 10 additions & 1 deletion lib/server/v2/RequestContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ var DefaultRequestContextExternalOptions = (function () {
host: 'localhost'
};
this.url = '/';
this.user = {
isAdministrator: true,
isDefaultUser: false,
password: null,
uid: '-1',
username: '_default_super_admin_'
};
}
return DefaultRequestContextExternalOptions;
}());
Expand Down Expand Up @@ -94,7 +101,9 @@ var RequestContext = (function () {
headers: options.headers,
url: options.url
}, null, null);
if (!options.user)
if (options.user)
ctx.user = options.user;
else
server.httpAuthentication.getUser(ctx, function (e, user) {
ctx.user = options.user;
callback(e, ctx);
Expand Down
11 changes: 10 additions & 1 deletion src/server/v2/RequestContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ export class DefaultRequestContextExternalOptions implements RequestContextExter
host: 'localhost'
}
url : string = '/'
user : IUser = {
isAdministrator: true,
isDefaultUser: false,
password: null,
uid: '-1',
username: '_default_super_admin_'
}
}

export class RequestContext
Expand Down Expand Up @@ -144,7 +151,9 @@ export class RequestContext
url: options.url
} as any, null, null);

if(!options.user)
if(options.user)
ctx.user = options.user;
else
server.httpAuthentication.getUser(ctx, (e, user) => {
ctx.user = options.user;
callback(e, ctx);
Expand Down

0 comments on commit 50e1194

Please sign in to comment.