1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00

Server: Defaults to enabling share when creating user from admin UI

This commit is contained in:
Laurent Cozic 2021-05-25 12:25:26 +02:00
parent 51051e0ee0
commit e59e3aa7d1
2 changed files with 7 additions and 2 deletions

View File

@ -38,6 +38,12 @@ function makeUser(isNew: boolean, fields: any): User {
return user;
}
function defaultUser(): User {
return {
can_share: 1,
};
}
function userIsNew(path: SubPath): boolean {
return path.id === 'new';
}
@ -72,6 +78,7 @@ router.get('users/:id', async (path: SubPath, ctx: AppContext, user: User = null
const userId = userIsMe(path) ? owner.id : path.id;
user = !isNew ? user || await userModel.load(userId) : null;
if (isNew && !user) user = defaultUser();
await userModel.checkIfAllowed(ctx.owner, AclAction.Read, user);

View File

@ -60,8 +60,6 @@ let createdDbPath_: string = null;
export async function beforeAllDb(unitName: string) {
createdDbPath_ = `${packageRootDir}/db-test-${unitName}.sqlite`;
console.info('PPPPPPPPPPPP', createdDbPath_);
const tempDir = `${packageRootDir}/temp/test-${unitName}`;
await fs.mkdirp(tempDir);