revert change for AOS related to lock owners

This commit is contained in:
Denys Vuika
2019-03-06 15:58:50 +00:00
parent 003cadfd86
commit 22a256f09b
2 changed files with 8 additions and 4 deletions

View File

@@ -165,7 +165,7 @@ describe('evaluators', () => {
expect(canOpenWithOffice(context)).toBeFalsy(); expect(canOpenWithOffice(context)).toBeFalsy();
}); });
it('should return [true] if current user is lock owner', () => { it('should return [false] if current user is lock owner', () => {
const context: any = { const context: any = {
profile: { profile: {
id: 'user1' id: 'user1'
@@ -186,7 +186,7 @@ describe('evaluators', () => {
} }
}; };
expect(canOpenWithOffice(context)).toBeTruthy(); expect(canOpenWithOffice(context)).toBeFalsy();
}); });
it('should return [true] if all checks succeed', () => { it('should return [true] if all checks succeed', () => {

View File

@@ -47,8 +47,12 @@ export function canOpenWithOffice(
file.entry.properties['cm:lockType'] === 'WRITE_LOCK' || file.entry.properties['cm:lockType'] === 'WRITE_LOCK' ||
file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK' file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK'
) { ) {
const lockOwner = file.entry.properties['cm:lockOwner']; return false;
return lockOwner && lockOwner.id === context.profile.id; }
const lockOwner = file.entry.properties['cm:lockOwner'];
if (lockOwner && lockOwner.id !== context.profile.id) {
return false;
} }
return true; return true;