--- /dev/null
+<div class="container pt-5">
+ <div class="col-lg-6 offset-lg-3">
+ <div class="alert alert-danger">
+ <span i18n>
+ No Working Locations Set for Staff Account
+ <a href="/eg/staff/circ/patron/{{userId}}/edit_perms">{{username}}</a>.
+ </span>
+ </div>
+ <hr/>
+ <div class="mt-3">
+ <a routerLink="/staff/login" i18n>Sign In Again</a>
+ </div>
+ </div>
+</div>
--- /dev/null
+import {Component, OnInit, AfterViewInit} from '@angular/core';
+import {Location} from '@angular/common';
+import {Router, ActivatedRoute} from '@angular/router';
+import {AuthService, AuthWsState} from '@eg/core/auth.service';
+
+@Component({
+ templateUrl : './login-not-allowed.component.html'
+})
+
+export class StaffLoginNotAllowedComponent implements OnInit, AfterViewInit {
+
+ username: string;
+ userId: number;
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private ngLocation: Location,
+ private auth: AuthService
+ ) {}
+
+ ngOnInit() {
+ this.username = this.auth.user().usrname();
+ this.userId = this.auth.user().id();
+ }
+
+ ngAfterViewInit() {
+ // Timeout allows us to force the logout, without the UI
+ // sending is immediately back to the login page.
+ setTimeout(() => this.auth.logout());
+ }
+}
+
+
+
// Not sure how to get the path without params... using this for now.
const path = state.url.split('?')[0];
- if (path === '/staff/login') {
+ if (path === '/staff/login' || path === '/staff/login-not-allowed') {
return of(true);
}
);
},
hasNotPerms => {
- this.observer.error(
- 'User does not have staff permissions');
+ this.router.navigate(['/staff/login-not-allowed']);
+ this.observer.error('User does not have staff permissions');
}
);
},
import {StaffResolver} from './resolver.service';
import {StaffComponent} from './staff.component';
import {StaffLoginComponent} from './login.component';
+import {StaffLoginNotAllowedComponent} from './login-not-allowed.component';
import {StaffSplashComponent} from './splash.component';
import {AboutComponent} from './about.component';
path: 'login',
component: StaffLoginComponent
}, {
+ // Attempt to login to the staff client w/o the needed permissions
+ // or work org unit.
+ path: 'login-not-allowed',
+ component: StaffLoginNotAllowedComponent
+ }, {
+ // Attempt to fetch a specific page the user does not have
+ // access to.
path: 'no_permission',
component: StaffSplashComponent
}, {
import {StaffLoginComponent} from './login.component';
import {StaffSplashComponent, AutofocusDirective} from './splash.component';
import {AboutComponent} from './about.component';
+import {StaffLoginNotAllowedComponent} from './login-not-allowed.component';
@NgModule({
declarations: [
StaffSplashComponent,
AutofocusDirective,
StaffLoginComponent,
+ StaffLoginNotAllowedComponent,
AboutComponent
],
imports: [