Demo shell improvements (#1199)

* #1197 auth guards

* #1197 restore lost router dependency to all libs

* #1197 ecm/bpm auth guards, home page

- ECM auth guard (redirect to Login if ECM auth is missing)
- BPM auth guard (redirect to Login if BPM auth is missing)
- new Home page and route, show details on demo areas

* css improvements

make app text white as per request
This commit is contained in:
Denys Vuika
2016-12-03 18:57:43 +00:00
committed by Eugenio Romano
parent 3a288c6b1b
commit 800a2a6530
29 changed files with 432 additions and 28 deletions

View File

@@ -41,6 +41,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -37,6 +37,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -45,6 +45,7 @@
"activiti"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -44,6 +44,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -48,6 +48,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -1,6 +1,11 @@
:host {
width: 100%;
}
.application-title {
color: white;
}
.logo {
position: absolute;
right: 20px;
@@ -131,4 +136,4 @@
}
.selectedIcon{
color: #e9f1f3!important;
}
}

View File

@@ -11,7 +11,7 @@
<div (click)="selectApp(app)" [ngClass]="['mdl-card mdl-cell', getTheme(app)]" *ngFor="let app of appList">
<div class="logo"><i class="material-icons">{{getBackgroundIcon(app)}}</i></div>
<div class="mdl-card__title">
<h1 class="mdl-card__title-text">{{app.name}}</h1>
<h1 class="mdl-card__title-text application-title">{{app.name}}</h1>
</div>
<div class="mdl-card__supporting-text">
<p>{{app.description}}</p>

View File

@@ -29,7 +29,10 @@ import {
AlfrescoTranslationService,
AlfrescoAuthenticationService,
AlfrescoContentService,
RenditionsService
RenditionsService,
AuthGuard,
AuthGuardEcm,
AuthGuardBpm
} from './src/services/index';
import { MATERIAL_DESIGN_DIRECTIVES } from './src/components/material/index';
@@ -48,6 +51,9 @@ export const ALFRESCO_CORE_PROVIDERS: any[] = [
AlfrescoTranslationLoader,
AlfrescoTranslationService,
RenditionsService,
AuthGuard,
AuthGuardEcm,
AuthGuardBpm,
...CONTEXT_MENU_PROVIDERS
];

View File

@@ -0,0 +1,53 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import {
CanActivate, Router, CanActivateChild,
ActivatedRouteSnapshot,
RouterStateSnapshot
} from '@angular/router';
import { AlfrescoAuthenticationService } from './AlfrescoAuthentication.service';
@Injectable()
export class AuthGuardBpm implements CanActivate, CanActivateChild {
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
let url: string = state.url;
return this.checkLogin(url);
}
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return this.canActivate(route, state);
}
checkLogin(url: string): boolean {
if (this.authService.isBpmLoggedIn()) {
return true;
}
// Store the attempted URL for redirecting
// this.authService.redirectUrl = url;
// Navigate to the login page with extras
this.router.navigate(['/login']);
return false;
}
}

View File

@@ -0,0 +1,53 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import {
CanActivate, Router, CanActivateChild,
ActivatedRouteSnapshot,
RouterStateSnapshot
} from '@angular/router';
import { AlfrescoAuthenticationService } from './AlfrescoAuthentication.service';
@Injectable()
export class AuthGuardEcm implements CanActivate, CanActivateChild {
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
let url: string = state.url;
return this.checkLogin(url);
}
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return this.canActivate(route, state);
}
checkLogin(url: string): boolean {
if (this.authService.isEcmLoggedIn()) {
return true;
}
// Store the attempted URL for redirecting
// this.authService.redirectUrl = url;
// Navigate to the login page with extras
this.router.navigate(['/login']);
return false;
}
}

View File

@@ -0,0 +1,53 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import {
CanActivate, Router, CanActivateChild,
ActivatedRouteSnapshot,
RouterStateSnapshot
} from '@angular/router';
import { AlfrescoAuthenticationService } from './AlfrescoAuthentication.service';
@Injectable()
export class AuthGuard implements CanActivate, CanActivateChild {
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
let url: string = state.url;
return this.checkLogin(url);
}
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return this.canActivate(route, state);
}
checkLogin(url: string): boolean {
if (this.authService.isLoggedIn()) {
return true;
}
// Store the attempted URL for redirecting
// this.authService.redirectUrl = url;
// Navigate to the login page with extras
this.router.navigate(['/login']);
return false;
}
}

View File

@@ -23,3 +23,6 @@ export * from './AlfrescoTranslation.service';
export * from './AlfrescoAuthentication.service';
export * from './AlfrescoContent.service';
export * from './renditions.service';
export * from './auth-guard.service';
export * from './auth-guard-ecm.service';
export * from './auth-guard-bpm.service';

View File

@@ -44,6 +44,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -52,6 +52,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -56,6 +56,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -52,7 +52,7 @@
"alfresco"
],
"dependencies": {
"@types/node": "^6.0.42",
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
@@ -60,7 +60,6 @@
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",

View File

@@ -31,6 +31,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -53,6 +53,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -31,6 +31,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -46,6 +46,7 @@
"alfresco"
],
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",

View File

@@ -31,6 +31,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"@angular/router": "3.0.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",