48 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/components/collabora-online.component.scss:
--------------------------------------------------------------------------------
1 | #loleafletframe {
2 | width: 100%;
3 | height: 100%;
4 | position: absolute;
5 | border: 0 none;
6 | }
7 |
8 | #loolcontainer {
9 | position: fixed;
10 | bottom: 0px;
11 | width: 100%;
12 | top: 48px;
13 | left: 0;
14 | background: white;
15 | }
16 |
17 | .adf-viewer-toolbar .mat-toolbar .adf-toolbar-title {
18 | width: auto;
19 | }
20 |
21 | .adf-viewer-toolbar .adf-toolbar-divider {
22 | display: none;
23 | }
24 |
25 | // todo: remove this when viewer supports extensions
26 | .adf-viewer-toolbar .mat-toolbar > button:last-child {
27 | display: none;
28 | }
29 |
30 | .adf-viewer.right_side--hide .adf-viewer__sidebar__right {
31 | width: 0;
32 | }
33 |
34 | .fileName{
35 | font-size: 14px;
36 | margin:auto;
37 | }
38 | .filler{
39 | flex: 1 1;
40 | }
41 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/components/collabora-online.component.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
19 |
20 | import { CollaboraOnlineComponent } from './collabora-online.component';
21 |
22 | describe('CollaboraComponent', () => {
23 | let component: CollaboraOnlineComponent;
24 | let fixture: ComponentFixture;
25 |
26 | beforeEach(async(() => {
27 | TestBed.configureTestingModule({
28 | declarations: [ CollaboraOnlineComponent ]
29 | })
30 | .compileComponents();
31 | }));
32 |
33 | beforeEach(() => {
34 | fixture = TestBed.createComponent(CollaboraOnlineComponent);
35 | component = fixture.componentInstance;
36 | fixture.detectChanges();
37 | });
38 |
39 | it('should create', () => {
40 | expect(component).toBeTruthy();
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora-online.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora-online.component.scss:
--------------------------------------------------------------------------------
1 | #loleafletframe {
2 | width: 100%;
3 | height: 100%;
4 | position: absolute;
5 | border: 0 none;
6 | }
7 |
8 | #loolcontainer {
9 | position: fixed;
10 | bottom: 0px;
11 | width: 100%;
12 | top: 48px;
13 | left: 0;
14 | background: white;
15 | }
16 |
17 | .adf-viewer-toolbar .mat-toolbar .adf-toolbar-title {
18 | width: auto;
19 | }
20 |
21 | .adf-viewer-toolbar .adf-toolbar-divider {
22 | display: none;
23 | }
24 |
25 | // todo: remove this when viewer supports extensions
26 | .adf-viewer-toolbar .mat-toolbar > button:last-child {
27 | display: none;
28 | }
29 |
30 | .adf-viewer.right_side--hide .adf-viewer__sidebar__right {
31 | width: 0;
32 | }
33 |
34 | .fileName{
35 | font-size: 14px;
36 | margin:auto;
37 | }
38 | .filler{
39 | flex: 1 1;
40 | }
41 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora-online.component.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
19 |
20 | import { ViewerCollaboraOnlineComponent } from './viewer-collabora-online.component';
21 |
22 | describe('CollaboraComponent', () => {
23 | let component: ViewerCollaboraOnlineComponent;
24 | let fixture: ComponentFixture;
25 |
26 | beforeEach(async(() => {
27 | TestBed.configureTestingModule({
28 | declarations: [ ViewerCollaboraOnlineComponent ]
29 | })
30 | .compileComponents();
31 | }));
32 |
33 | beforeEach(() => {
34 | fixture = TestBed.createComponent(ViewerCollaboraOnlineComponent);
35 | component = fixture.componentInstance;
36 | fixture.detectChanges();
37 | });
38 |
39 | it('should create', () => {
40 | expect(component).toBeTruthy();
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora.module.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 | import { NgModule } from '@angular/core';
19 | import { CommonModule } from '@angular/common';
20 |
21 | import { ViewerCollaboraOnlineComponent } from './viewer-collabora-online.component';
22 |
23 | @NgModule({
24 | declarations: [ViewerCollaboraOnlineComponent],
25 | entryComponents: [ViewerCollaboraOnlineComponent],
26 | exports: [ViewerCollaboraOnlineComponent],
27 | imports: [
28 | CommonModule
29 | ],
30 | providers: []
31 | })
32 |
33 | export class ViewerCollaboraModule {}
34 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/effects/collabora-online.effects.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 | import { Injectable } from '@angular/core';
19 | import { Actions, Effect, ofType } from '@ngrx/effects';
20 | import { map } from 'rxjs/operators';
21 |
22 | import { CollaboraOnlineEdit, COLLABORA_EDIT } from '../actions/collabora-online.actions';
23 | import { CollaboraOnlineService } from '../services/collabora-online.service';
24 |
25 | @Injectable()
26 | export class CollaboraEffects {
27 | constructor( private actions$: Actions, private collaboraOnlineService: CollaboraOnlineService) {}
28 |
29 | @Effect({ dispatch: false })
30 | collaboraOnlineEdit$ = this.actions$.pipe(
31 | ofType(COLLABORA_EDIT),
32 | map(action => {
33 | if (action.payload) {
34 | this.collaboraOnlineService.onEdit(action.payload);
35 | }
36 | })
37 | );
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/rules/evaluators.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | export function canUseCollaboraExtension(context): boolean {
20 | if (
21 | context.navigation &&
22 | context.navigation.url &&
23 | context.navigation.url.startsWith("/trashcan")
24 | ) {
25 | return false;
26 | }
27 |
28 | // check if collabora is enabled
29 | if (!context || !context.appConfig.get('collabora.enable')) {
30 | return false;
31 | }
32 |
33 | // check if element is selected
34 | if (!context || !context.selection) {
35 | return false;
36 | }
37 |
38 | return true;
39 | }
40 |
41 | export function getExtension(filename: string): string {
42 | const position = filename.lastIndexOf('.');
43 | return filename.substring(position + 1);
44 | }
45 |
46 | export function canEditWithCollaboraOnline(context): boolean {
47 | if (canUseCollaboraExtension(context)) {
48 | const { file } = context.selection;
49 |
50 | // check if is file
51 | if (!file || !file.entry) {
52 | return false;
53 | }
54 |
55 | // check if file is locked
56 | if (file.entry.isLocked) {
57 | return false;
58 | }
59 | if (!file.entry.properties) {
60 | return false;
61 | }
62 | if (file.entry.properties['cm:lockType'] === 'WRITE_LOCK'
63 | || file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK') {
64 | return false;
65 | }
66 | const lockOwner = file.entry.properties['cm:lockOwner'];
67 | if (lockOwner && lockOwner.id !== context.profile.id) {
68 | return false;
69 | }
70 |
71 | // check the extension of file
72 | const extension: string = getExtension(file.entry.name);
73 | const extCanEdit: string[] = context.appConfig.get('collabora.edit');
74 | if (!extension) {
75 | return false;
76 | }
77 | if (extCanEdit.indexOf(extension) > -1) {
78 | return context.permissions.check(file, ['update']);
79 | }
80 | }
81 | return false;
82 | }
83 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/lib/services/collabora-online.service.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 | import { TestBed } from '@angular/core/testing';
19 |
20 | import { CollaboraOnlineService } from './collabora-online.service';
21 |
22 | describe('CollaboraOnlineService', () => {
23 | beforeEach(() => TestBed.configureTestingModule({}));
24 |
25 | it('should be created', () => {
26 | const service: CollaboraOnlineService = TestBed.get(CollaboraOnlineService);
27 | expect(service).toBeTruthy();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/public_api.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Public API Surface of collabora extension
3 | */
4 |
5 | export * from './lib/components/collabora-online.component';
6 | export * from './lib/components/collabora-online.module';
7 |
8 | export * from './lib/components/viewer/viewer-collabora.module';
9 | export * from './lib/components/viewer/viewer-collabora-online.component';
10 |
11 | export * from './lib/services/collabora-online.service';
12 | export * from './lib/rules/evaluators';
13 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'core-js/es7/reflect';
4 | import 'zone.js/dist/zone';
5 | import 'zone.js/dist/zone-testing';
6 | import { getTestBed } from '@angular/core/testing';
7 | import {
8 | BrowserDynamicTestingModule,
9 | platformBrowserDynamicTesting
10 | } from '@angular/platform-browser-dynamic/testing';
11 |
12 | declare const require: any;
13 |
14 | // First, initialize the Angular testing environment.
15 | getTestBed().initTestEnvironment(
16 | BrowserDynamicTestingModule,
17 | platformBrowserDynamicTesting()
18 | );
19 | // Then we find all the tests.
20 | const context = require.context('./', true, /\.spec\.ts$/);
21 | // And load the modules.
22 | context.keys().map(context);
23 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/lib",
5 | "target": "es2015",
6 | "module": "es2015",
7 | "moduleResolution": "node",
8 | "declaration": true,
9 | "sourceMap": true,
10 | "inlineSources": true,
11 | "emitDecoratorMetadata": true,
12 | "experimentalDecorators": true,
13 | "importHelpers": true,
14 | "types": [],
15 | "lib": [
16 | "dom",
17 | "es2015"
18 | ]
19 | },
20 | "angularCompilerOptions": {
21 | "annotateForClosureCompiler": true,
22 | "skipTemplateCodegen": true,
23 | "strictMetadataEmit": true,
24 | "fullTemplateTypeCheck": true,
25 | "strictInjectionParameters": true,
26 | "enableResourceInlining": true
27 | },
28 | "exclude": [
29 | "src/test.ts",
30 | "**/*.spec.ts"
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/tsconfig.schematics.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "lib": [
5 | "es2018",
6 | "dom"
7 | ],
8 | "declaration": true,
9 | "module": "commonjs",
10 | "moduleResolution": "node",
11 | "noEmitOnError": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "noImplicitAny": true,
14 | "noImplicitThis": true,
15 | "noUnusedParameters": true,
16 | "noUnusedLocals": true,
17 | "rootDir": "schematics",
18 | "outDir": "../../dist/@jeci/collabora-online-extension/schematics",
19 | "skipDefaultLibCheck": true,
20 | "skipLibCheck": true,
21 | "sourceMap": true,
22 | "strictNullChecks": true,
23 | "target": "es6",
24 | "types": [
25 | "jasmine",
26 | "node"
27 | ]
28 | },
29 | "include": [
30 | "schematics/**/*"
31 | ],
32 | "exclude": [
33 | "schematics/*/files/**/*"
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts"
12 | ],
13 | "include": [
14 | "**/*.spec.ts",
15 | "**/*.d.ts"
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/collabora-aca-extension/projects/collabora-online-extension/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "lib",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "lib",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/collabora-aca-extension/src/main/assembly/assembly.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | dist
8 |
9 |
10 | tgz
11 |
12 |
13 | false
14 |
15 |
16 |
17 |
18 | dist/@jeci/collabora-online-extension/
19 | package
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/collabora-aca-extension/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "target": "es5",
13 | "typeRoots": [
14 | "node_modules/@types"
15 | ],
16 | "lib": [
17 | "es2017",
18 | "dom"
19 | ],
20 | "paths": {
21 | "collabora-online-extension": [
22 | "dist/collabora-online-extension"
23 | ],
24 | "collabora-online-extension/*": [
25 | "dist/collabora-online-extension/*"
26 | ]
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/collabora-online-integration-tests/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | collabora-online-integration-tests
6 | Integration Tests Module
7 | Integration Tests module for in-container integration testing - part of AIO - SDK 4.0
8 | jar
9 |
10 |
11 | fr.jeci.alfresco
12 | alfresco-collabora-online
13 | 0.3.0
14 |
15 |
16 |
17 |
18 |
19 | fr.jeci.alfresco
20 | collabora-online-platform
21 | 0.3.0
22 | test
23 |
24 |
25 |
26 |
27 |
28 |
29 | src/test/resources
30 | true
31 |
32 |
33 |
34 |
35 |
36 | org.zeroturnaround
37 | jrebel-maven-plugin
38 |
39 | ${project.build.testOutputDirectory}
40 |
41 |
42 |
43 |
44 | org.apache.maven.plugins
45 | maven-jar-plugin
46 |
47 |
48 |
49 | test-jar
50 |
51 |
52 |
53 |
54 |
55 |
56 | org.apache.maven.plugins
57 | maven-failsafe-plugin
58 |
59 |
60 | ${test.acs.endpoint.path}
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/collabora-online.component.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Jeci.
3 | * https://jeci.fr/
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | */
18 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
19 |
20 | import { CollaboraOnlineComponent } from './collabora-online.component';
21 |
22 | describe('CollaboraComponent', () => {
23 | let component: CollaboraOnlineComponent;
24 | let fixture: ComponentFixture;
25 |
26 | beforeEach(async(() => {
27 | TestBed.configureTestingModule({
28 | declarations: [ CollaboraOnlineComponent ]
29 | })
30 | .compileComponents();
31 | }));
32 |
33 | beforeEach(() => {
34 | fixture = TestBed.createComponent(CollaboraOnlineComponent);
35 | component = fixture.componentInstance;
36 | fixture.detectChanges();
37 | });
38 |
39 | it('should create', () => {
40 | expect(component).toBeTruthy();
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ${docker.acs.image}:${docker.acs.version}
2 |
3 | ARG TOMCAT_DIR=/usr/local/tomcat
4 | ARG USERNAME=${docker.acs.user}
5 |
6 | USER root
7 |
8 | WORKDIR ${TOMCAT_DIR}/keystore
9 |
10 | COPY keystore/keystore ${TOMCAT_DIR}/keystore/keystore
11 | COPY keystore/ssl.keystore ${TOMCAT_DIR}/keystore/ssl.keystore
12 | COPY keystore/ssl.truststore ${TOMCAT_DIR}/keystore/ssl.truststore
13 |
14 | RUN chown -R ${USERNAME}:${USERNAME} ${TOMCAT_DIR}/keystore
15 |
16 | # Copy Dockerfile to avoid an error if no JARs exist
17 | COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/alfresco/WEB-INF/lib/
18 |
19 | # Copy Dockerfile to avoid an error if no AMPs exist
20 | COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/
21 | RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
22 | $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force
23 |
24 | COPY alfresco-global.properties $TOMCAT_DIR/shared/classes/alfresco-global.properties
25 | COPY dev-log4j.properties $TOMCAT_DIR/shared/classes/alfresco/extension
26 | COPY disable-webscript-caching-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension
27 |
28 | RUN mkdir -p /var/log/alfresco && chown -R ${USERNAME}:${USERNAME} /var/log/alfresco
29 |
30 | USER ${USERNAME}
31 |
32 | COPY alfresco-keystore.jar ${TOMCAT_DIR}/webapps/alfresco/WEB-INF/lib/
33 | COPY keystore-context.xml ${TOMCAT_DIR}/shared/classes/alfresco/extension/
34 |
35 | WORKDIR ${TOMCAT_DIR}
36 |
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/alfresco-keystore.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/alfresco-keystore.jar
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/hotswap-agent.properties:
--------------------------------------------------------------------------------
1 | # Enable hotswap so that changes in this module will be automatically reloaded
2 | # Watch for changed class files on watchResources path and reload class definition in the running application.
3 | autoHotswap=true
4 | #autoHotswap.port=8000
5 |
6 | # Add a directory prior to application classpath (load classes and resources).
7 | #
8 | # This may be useful for example in multi module maven project to load class changes from upstream project
9 | # classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
10 | # classes from built JAR file.
11 | # i.e. monitor /target/classes
12 | # should work with extraClasspath=${project.build.outputDirectory}
13 | # If not try
14 | extraClasspath=/usr/local/tomcat/hotswap-agent
15 |
16 | # Comma separated list of disabled plugins
17 | # Use plugin name - e.g.
18 | # Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat,
19 | # ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae
20 | disabledPlugins=Hibernate,Spring
21 |
22 | # Add a directory prior to webapp path (load webapp resources).
23 | #
24 | # Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
25 | # Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
26 | extraWebappContext=/usr/local/tomcat/hotswap-agent/alfresco-collabora-online-platform/target/classes/META-INF/resources;
27 |
28 | # Load static web resources from different directory.
29 | #
30 | # This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
31 | webappDir=/usr/local/tomcat/hotswap-agent/alfresco-collabora-online-platform/target/classes/META-INF/resources;
32 |
33 | # Watch for changes in a directory (resources only).
34 | #
35 | # Similar to extraClasspath this property adds classpath when searching for resources (not classes).
36 | # While extra classpath just modifies the classloader, this setting does nothing until the resource
37 | # is really changed.
38 | #
39 | # Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
40 | # replacements of resources in a building step (maven filtering resource option).
41 | # This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
42 | # in src/main/resources, the new changed resource is served instead.
43 | # watchResources=
44 |
45 | LOGGER.org.hotswap.agent=DEBUG
46 | #LOGGER.org.hotswap.agent.plugin=TRACE
47 | #LOGGER.org.hotswap.agent.watch=TRACE
48 | #LOGGER.org.hotswap.agent.command=TRACE
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/keystore-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/keystore/keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/keystore/keystore
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/keystore/ssl.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/keystore/ssl.keystore
--------------------------------------------------------------------------------
/collabora-platform-extension-docker/src/main/docker/keystore/ssl.truststore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/keystore/ssl.truststore
--------------------------------------------------------------------------------
/collabora-platform-extension/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | collabora-platform-extension
7 | Collabora Online Alfresco Platform Module
8 | Collabora Online JAR Module for Alfresco Platform/Repo
9 | jar
10 |
11 |
12 | fr.jeci.alfresco
13 | alfresco-collabora-online
14 | 1.2.0
15 |
16 |
17 |
18 |
19 |
20 | org.apache.maven.plugins
21 | maven-assembly-plugin
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/assembly/amp.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
18 |
19 | build-amp-file
20 |
21 |
22 | amp
23 |
24 |
25 | false
26 |
27 |
28 |
29 |
30 | src/main/resources/alfresco/module/${project.artifactId}/module.properties
31 | true
32 |
33 |
34 |
35 | src/main/assembly/file-mapping.properties
36 | false
37 |
38 |
39 |
40 | src/main/resources/alfresco/module/${project.artifactId}/log4j.properties
41 | false
42 |
43 |
44 |
45 |
46 |
47 |
48 | src/main/assembly/web
49 | web
50 | true
51 |
52 | README.md
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 | lib
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/assembly/file-mapping.properties:
--------------------------------------------------------------------------------
1 | # Custom AMP to WAR location mappings
2 |
3 | #
4 | # The following property can be used to include the standard set of mappings.
5 | # The contents of this file will override any defaults. The default is
6 | # 'true', i.e. the default mappings will be augmented or modified by values in
7 | # this file.
8 | #
9 | # Default mappings are:
10 | #
11 | # /config=/WEB-INF/classes
12 | # /lib=/WEB-INF/lib
13 | # /licenses=/WEB-INF/licenses
14 | # /web/jsp=/jsp
15 | # /web/css=/css
16 | # /web/images=/images
17 | # /web/scripts=/scripts
18 | # /web/php=/php
19 | #
20 | include.default=true
21 |
22 | #
23 | # Custom mappings. If 'include.default' is false, then this is the complete set.
24 | # Map /web to / in AMP so we can override things like favicon.ico
25 | #
26 | /web=/
27 |
28 |
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/assembly/web/README.md:
--------------------------------------------------------------------------------
1 | # Web resources that should override out-of-the-box files
2 |
3 | Put here any web resources that should override out-of-the-box
4 | web resources, such as favicon.ico. They will then end up in the
5 | */web* directory in the AMP, and applied to the WAR, and override
6 | any existing web resources in the Alfresco.WAR.
7 |
8 | **Note**. Module dependency needs to be set to amp for the web resources to be applied by MMT:
9 |
10 | `
11 |
12 | ${project.groupId}
13 | some-platform
14 | ${project.version}
15 | amp
16 |
17 | `
18 |
19 | **Important**. New web resources should not be located here, but instead
20 | in the usual place in the *src/main/resources/META-INF/resources* directory.
21 |
22 |
23 |
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/CollaboraOnlineModel.java:
--------------------------------------------------------------------------------
1 | package fr.jeci.collabora.alfresco;
2 |
3 | import org.alfresco.service.namespace.QName;
4 |
5 | /**
6 | * Content Model Constants
7 | *
8 | * @author jlesage
9 | * @Deprecated We use LockService now
10 | */
11 | public interface CollaboraOnlineModel {
12 |
13 | /** Content Model URI */
14 | String COLLABORA_MODEL_1_0_URI = "http://www.collaboraoffice.com/model/online/1.0";
15 |
16 | /** Content Model Prefix */
17 | String COLLABORA_MODEL_PREFIX = "collabora";
18 |
19 | /** @Deprecated Adding Aspect change node, that is not what we want */
20 | QName ASPECT_COLLABORA_ONLINE = QName.createQName(COLLABORA_MODEL_1_0_URI, "collaboraOnline");
21 |
22 | QName PROP_AUTOSAVE = QName.createQName(COLLABORA_MODEL_1_0_URI, "autosave");
23 |
24 | /** @Deprecated Use LockService */
25 | QName PROP_LOCK_ID = QName.createQName(COLLABORA_MODEL_1_0_URI, "lockId");
26 | /** @Deprecated Use LockService */
27 | QName PROP_LOCK_EXPIRATION = QName.createQName(COLLABORA_MODEL_1_0_URI, "lockExpiration");
28 |
29 | }
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/ConflictException.java:
--------------------------------------------------------------------------------
1 | package fr.jeci.collabora.alfresco;
2 |
3 | /**
4 | * Specific exception use to implement wopi "409" error. Mainly for Lock
5 | * problem.
6 | *
7 | * ...
8 | *
9 | * @author jlesage
10 | *
11 | */
12 | public class ConflictException extends Exception {
13 | private static final long serialVersionUID = -5116720784148049930L;
14 |
15 | private final String currentLockId;
16 |
17 | private final String lockFailureReason;
18 |
19 | /**
20 | *
21 | * @param currentLockId A string value identifying the current lock on the
22 | * file;
23 | * @param lockFailureReason An string value indicating the cause of a lock
24 | * failure.
25 | */
26 | public ConflictException(String currentLockId, String lockFailureReason) {
27 | this.currentLockId = currentLockId;
28 | this.lockFailureReason = lockFailureReason;
29 | }
30 |
31 | public String getCurrentLockId() {
32 | return currentLockId;
33 | }
34 |
35 | public String getLockFailureReason() {
36 | return lockFailureReason;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/GetTokenWebScript.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one or more
3 | contributor license agreements. See the NOTICE file distributed with
4 | this work for additional information regarding copyright ownership.
5 | The ASF licenses this file to You under the Apache License, Version 2.0
6 | (the "License"); you may not use this file except in compliance with
7 | the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | package fr.jeci.collabora.alfresco;
18 |
19 | import org.alfresco.service.cmr.repository.NodeRef;
20 | import org.slf4j.Logger;
21 | import org.slf4j.LoggerFactory;
22 | import org.springframework.extensions.webscripts.*;
23 |
24 | import java.io.IOException;
25 | import java.util.HashMap;
26 | import java.util.Map;
27 |
28 | public class GetTokenWebScript extends DeclarativeWebScript {
29 | private static final Logger logger = LoggerFactory.getLogger(GetTokenWebScript.class);
30 |
31 | private static final String WOPI_SRC_URL = "wopi_src_url";
32 | private static final String ACCESS_TOKEN_TTL = "access_token_ttl";
33 | private static final String ACCESS_TOKEN = "access_token";
34 | private static final String PARAM_ACTION = "action";
35 | private static final String PARAM_NODE_REF = "nodeRef";
36 |
37 | protected CollaboraOnlineService collaboraOnlineService;
38 |
39 | @Override
40 | protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) {
41 | final Map model = new HashMap<>();
42 | final String nodeRefStr = req.getParameter(PARAM_NODE_REF);
43 | if (nodeRefStr == null) {
44 | throw new WebScriptException("No 'nodeRef' parameter supplied");
45 | }
46 |
47 | final NodeRef nodeRef = new NodeRef(nodeRefStr);
48 | final String action = req.getParameter(PARAM_ACTION);
49 | if (action == null) {
50 | throw new WebScriptException("No 'action' parameter supplied");
51 | }
52 |
53 | final WOPIAccessTokenInfo tokenInfo = this.collaboraOnlineService.createAccessToken(nodeRef);
54 | model.put(ACCESS_TOKEN, tokenInfo.getAccessToken());
55 | model.put(ACCESS_TOKEN_TTL, tokenInfo.getExpiresAt().toDate().getTime());
56 |
57 | try {
58 | String wopiSrcUrl = this.collaboraOnlineService.getWopiSrcURL(nodeRef, action);
59 | logger.debug("Get Token {} for wopiSrcUrl {}", action, wopiSrcUrl);
60 | model.put(WOPI_SRC_URL, wopiSrcUrl);
61 | } catch (IOException e) {
62 | status.setCode(Status.STATUS_INTERNAL_SERVER_ERROR, "Failed to get wopiSrcURL");
63 | }
64 | return model;
65 | }
66 |
67 | public void setCollaboraOnlineService(CollaboraOnlineService collaboraOnlineService) {
68 | this.collaboraOnlineService = collaboraOnlineService;
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/ServiceUrlInfoWebScript.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one or more
3 | contributor license agreements. See the NOTICE file distributed with
4 | this work for additional information regarding copyright ownership.
5 | The ASF licenses this file to You under the Apache License, Version 2.0
6 | (the "License"); you may not use this file except in compliance with
7 | the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | package fr.jeci.collabora.alfresco;
18 |
19 | import java.net.MalformedURLException;
20 | import java.net.URL;
21 | import java.util.HashMap;
22 | import java.util.Map;
23 |
24 | import org.springframework.extensions.webscripts.Cache;
25 | import org.springframework.extensions.webscripts.DeclarativeWebScript;
26 | import org.springframework.extensions.webscripts.Status;
27 | import org.springframework.extensions.webscripts.WebScriptException;
28 | import org.springframework.extensions.webscripts.WebScriptRequest;
29 |
30 | /**
31 | * Don't think this is usefull
32 | */
33 | public class ServiceUrlInfoWebScript extends DeclarativeWebScript {
34 | private static final String LOOL_HOST_URL = "lool_host_url";
35 | private static final String ALFRESCO_SERVICE = "service/";
36 |
37 | protected CollaboraOnlineService collaboraOnlineService;
38 |
39 | @Override
40 | protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) {
41 | URL alfrescoPrivateURL = this.collaboraOnlineService.getAlfrescoPrivateURL();
42 | URL colServiceUrl;
43 | try {
44 | colServiceUrl = new URL(alfrescoPrivateURL, ALFRESCO_SERVICE);
45 | } catch (MalformedURLException e) {
46 | throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
47 | "Invalid Wopi Server URL :" + alfrescoPrivateURL);
48 | }
49 |
50 | Map model = new HashMap<>(1);
51 | model.put(LOOL_HOST_URL, colServiceUrl.toString());
52 | return model;
53 | }
54 |
55 | public void setCollaboraOnlineService(CollaboraOnlineService collaboraOnlineService) {
56 | this.collaboraOnlineService = collaboraOnlineService;
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/WebscriptHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one or more
3 | contributor license agreements. See the NOTICE file distributed with
4 | this work for additional information regarding copyright ownership.
5 | The ASF licenses this file to You under the Apache License, Version 2.0
6 | (the "License"); you may not use this file except in compliance with
7 | the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | package fr.jeci.collabora.alfresco;
18 |
19 | import java.util.Map;
20 |
21 | import org.apache.commons.lang3.StringUtils;
22 | import org.springframework.extensions.webscripts.Status;
23 | import org.springframework.extensions.webscripts.WebScriptException;
24 | import org.springframework.extensions.webscripts.WebScriptRequest;
25 |
26 | public class WebscriptHelper {
27 | private WebscriptHelper() {
28 | // No Constructor
29 | }
30 |
31 | /**
32 | * Get Mandatory parameters from Map
33 | */
34 | public static String getParam(Map templateArgs, String header) throws WebScriptException {
35 | String value = templateArgs.get(header);
36 | assertParam(header, value);
37 | return value;
38 | }
39 |
40 | /**
41 | * Assert param is not null or empty
42 | *
43 | * @param header Need only for log
44 | * @param param value tested
45 | */
46 | public static void assertParam(String header, String param) throws WebScriptException {
47 | if (StringUtils.isBlank(param)) {
48 | throw new WebScriptException(Status.STATUS_BAD_REQUEST, "No '" + header + "' parameter supplied");
49 | }
50 | }
51 |
52 | /**
53 | * Get parameter as Integer (Not Mandatory)
54 | *
55 | * @return integer or null
56 | */
57 | public static Integer integerValue(Map templateArgs, String header) throws WebScriptException {
58 | return integerValue(templateArgs.get(header), header);
59 | }
60 |
61 | /**
62 | * Get parameter as Integer (Not Mandatory)
63 | */
64 | public static Integer integerValue(WebScriptRequest req, String header) throws WebScriptException {
65 | return integerValue(req.getParameter(header), header);
66 | }
67 |
68 | /**
69 | * Get parameter as Integer (Not Mandatory)
70 | *
71 | * @param header Need only for log
72 | */
73 | public static Integer integerValue(String strVal, String header) throws WebScriptException {
74 | if (strVal == null) {
75 | return null;
76 | }
77 | try {
78 | return Integer.parseInt(strVal);
79 | } catch (NumberFormatException e) {
80 | throw new WebScriptException(Status.STATUS_BAD_REQUEST,
81 | "Parameter '" + header + "' is not a number = " + strVal);
82 | }
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/job/CleanLockJob.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one or more
3 | contributor license agreements. See the NOTICE file distributed with
4 | this work for additional information regarding copyright ownership.
5 | The ASF licenses this file to You under the Apache License, Version 2.0
6 | (the "License"); you may not use this file except in compliance with
7 | the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 | */
17 | package fr.jeci.collabora.alfresco.job;
18 |
19 | import org.alfresco.error.AlfrescoRuntimeException;
20 | import org.alfresco.repo.security.authentication.AuthenticationUtil;
21 | import org.alfresco.schedule.AbstractScheduledLockedJob;
22 | import org.quartz.JobDataMap;
23 | import org.quartz.JobExecutionContext;
24 | import org.quartz.JobExecutionException;
25 | import org.quartz.StatefulJob;
26 |
27 | /**
28 | * @author Cindy Piassale
29 | *
30 | */
31 | public class CleanLockJob extends AbstractScheduledLockedJob implements StatefulJob {
32 |
33 | @Override
34 | public void executeJob(JobExecutionContext context) throws JobExecutionException {
35 | JobDataMap jobData = context.getJobDetail().getJobDataMap();
36 |
37 | // Extract the Job executer to use
38 | Object executerObj = jobData.get("jobExecuter");
39 | if (!(executerObj instanceof CleanLockJobExecuter)) {
40 | throw new AlfrescoRuntimeException(
41 | "CleanLockJob data must contain valid 'Executer' reference");
42 | }
43 |
44 | final CleanLockJobExecuter cleanLockjobExecuter = (CleanLockJobExecuter) executerObj;
45 |
46 | AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork