mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Fix
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PermissionService } from './worker/permission.service';
|
||||
|
||||
describe('PermissionService', () => {
|
||||
let service: PermissionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PermissionService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
import { AttachmentsService } from '../attachments.service';
|
||||
import { EventsService } from '../events.service';
|
||||
import { PermissionService } from '../worker/permission.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DocumentCounterService } from './document-counter.service';
|
||||
|
||||
describe('DocumentCounterService', () => {
|
||||
let service: DocumentCounterService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(DocumentCounterService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { PendentesStore } from 'src/app/store/pendestes-store.service';
|
||||
import { PedidosStore } from 'src/app/store/pedidos-store.service';
|
||||
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
||||
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DocumentCounterService {
|
||||
|
||||
expedienteGbStore = ExpedienteGdStore;
|
||||
pendentesStore = PendentesStore;
|
||||
despachoStore = DespachoStore;
|
||||
eventoAprovacaoStore = EventoAprovacaoStore;
|
||||
pedidosStore = PedidosStore;
|
||||
// expedientePrStore = ExpedienteprStore;
|
||||
despachoPrStore = DespachosprStore;
|
||||
deplomasStore = DeplomasStore
|
||||
|
||||
constructor() { }
|
||||
|
||||
// falta a contagem dos deplomas
|
||||
get mdTotalDocument(): number {
|
||||
return this.despachoStore.count + /** this.expedientePrStore.count + */ this.pedidosStore.countdeferimento
|
||||
+ this.pedidosStore.countparecer + this.expedienteGbStore.count + this.despachoPrStore.count + this.pendentesStore.count
|
||||
+ this.eventoAprovacaoStore.count + this.deplomasStore.diplomasListCount + this.deplomasStore.countDiplomasAssinadoListCount + this.deplomasStore.deplomasReviewCount
|
||||
}
|
||||
|
||||
get prTotalDocument(): number {
|
||||
return this.despachoStore.count + /** this.expedientePrStore.count + */ this.pedidosStore.countdeferimento
|
||||
+ this.pedidosStore.countparecer + this.expedienteGbStore.count + this.despachoPrStore.count + this.pendentesStore.count
|
||||
+ this.eventoAprovacaoStore.count + this.deplomasStore.diplomasListCount + this.deplomasStore.countDiplomasAssinadoListCount + this.deplomasStore.deplomasReviewCount
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SessionStore } from '../../store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PermissionService {
|
||||
|
||||
SessionStore = SessionStore
|
||||
|
||||
constructor() { }
|
||||
|
||||
userRole(args) {
|
||||
|
||||
if(!Array.isArray(args)) {
|
||||
args = [args]
|
||||
}
|
||||
|
||||
return args.includes(this.SessionStore.user.Profile)
|
||||
}
|
||||
|
||||
role(args: any) {
|
||||
|
||||
let UserRoleIsValid = this.userRole(args)
|
||||
|
||||
return {
|
||||
permissionAnyOf(role) {
|
||||
|
||||
if(!Array.isArray(role)) {
|
||||
role = [role]
|
||||
}
|
||||
|
||||
if(!UserRoleIsValid) {return false }
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user