mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PermissionService } from './permission.service';
|
||||
|
||||
describe('PermissionService', () => {
|
||||
let service: PermissionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PermissionService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { UserStore } from 'src/app/store/user.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PermissionService {
|
||||
|
||||
userStore = UserStore
|
||||
|
||||
constructor() { }
|
||||
|
||||
userRole(args) {
|
||||
let data: string[] = []
|
||||
|
||||
if(!Array.isArray(args) && typeof(args) == 'string') {
|
||||
data = [args]
|
||||
} else {
|
||||
data = args
|
||||
}
|
||||
|
||||
return data.includes(this.userStore.user.Profile)
|
||||
}
|
||||
|
||||
role(args: any) {
|
||||
|
||||
|
||||
let UserRoleIsValid = this.userRole(args)
|
||||
|
||||
return {
|
||||
permissionAnyOf(role) {
|
||||
|
||||
if(!Array.isArray(args) && typeof(args) == 'string') {
|
||||
role = [args]
|
||||
}
|
||||
|
||||
if(!UserRoleIsValid) {return false }
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -332,7 +332,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
async getDoc() {
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'modal modal-desktop modal-width-100-width-background',
|
||||
cssClass: 'modal modal-desktop modal-width-100-width-background modal-background',
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
showSearchInput: true,
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<p class="text-center exp-card-content">{{ despachoprstore.count }} <span class="title1">Documentos</span> </p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="loggeduser.Profile == 'MDGPR'" (click)="openExpedientesPrPage(); selectedElement='ExpedientesPr'" [class.active]="selectedElement == 'ExpedientesPr'" class="exp-card-long justify-center width-100 white-background">
|
||||
<div *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientesPrPage(); selectedElement='ExpedientesPr'" [class.active]="selectedElement == 'ExpedientesPr'" class="exp-card-long justify-center width-100 white-background">
|
||||
<div class="center-div">
|
||||
<div class="exp-card-icon">
|
||||
<ion-icon src="assets/images/icons-expediente-presidente.svg"></ion-icon>
|
||||
|
||||
@@ -20,6 +20,7 @@ import { PendentesStore } from 'src/app/store/pendestes-store.service';
|
||||
import { PedidosStore } from 'src/app/store/pedidos-store.service';
|
||||
import { ExpedienteprStore } from 'src/app/store/expedientepr-store.service';
|
||||
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
@Component({
|
||||
selector: 'app-gabinete-digital',
|
||||
templateUrl: './gabinete-digital.page.html',
|
||||
@@ -99,9 +100,10 @@ export class GabineteDigitalPage implements OnInit {
|
||||
private alertService: AlertService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
authService: AuthService
|
||||
authService: AuthService,
|
||||
public p: PermissionService
|
||||
) {
|
||||
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
window.onresize = (event) => {
|
||||
@@ -123,6 +125,7 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const pathname = window.location.pathname
|
||||
this.LoadCounts();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { AuthConnstants } from '../config/auth-constants';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { LocalstoreService } from '../store/localstore.service';
|
||||
import { ToastService } from './toast.service';
|
||||
import { UserStore } from 'src/app/store/user.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -18,9 +19,10 @@ export class AuthService {
|
||||
userData$ = new BehaviorSubject<any>('');
|
||||
userId$ = new BehaviorSubject<any>('');
|
||||
headers: HttpHeaders;
|
||||
public ValidatedUser:User;
|
||||
public ValidatedUser: User;
|
||||
public ValidatedUserChat:any;
|
||||
opts:any;
|
||||
userStore = UserStore
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@@ -74,7 +76,10 @@ export class AuthService {
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
console.log('response', response)
|
||||
|
||||
this.localstoreService.set('user', response)
|
||||
this.userStore.reset(response)
|
||||
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
|
||||
|
||||
@@ -427,6 +427,7 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
|
||||
async getDoc() {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'modal-width-100-width-background modal',
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AES, enc, SHA1 } from 'crypto-js'
|
||||
})
|
||||
export class LocalstoreService {
|
||||
|
||||
private prefix = 'v12-'
|
||||
private prefix = 'v13-'
|
||||
|
||||
constructor() {
|
||||
|
||||
@@ -58,3 +58,19 @@ export class LocalstoreService {
|
||||
}
|
||||
|
||||
export const localstoreService = new LocalstoreService()
|
||||
|
||||
|
||||
|
||||
// Create WebSocket connection.
|
||||
const socket = new WebSocket('ws://localhost:8080');
|
||||
|
||||
// Listen for messages
|
||||
socket.addEventListener('message', function (event) {
|
||||
console.log('Message from server ', event.data); // Message from server mobile first é fraco
|
||||
|
||||
var p = Promise.resolve(event.data);
|
||||
p.then(function(v) {
|
||||
console.log(v); // mobile first é fraco
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserService } from './user.service';
|
||||
|
||||
describe('UserService', () => {
|
||||
let service: UserService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(UserService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { SHA1 } from 'crypto-js'
|
||||
import { User } from '../models/user.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserService {
|
||||
|
||||
// main data
|
||||
private _user: User = {
|
||||
Authorization: "",
|
||||
BasicAuthKey: "",
|
||||
Email: "",
|
||||
FullName: "",
|
||||
Profile: "",
|
||||
RoleDescription: "",
|
||||
RoleID: 0,
|
||||
SharedCalendars: [],
|
||||
OwnerCalendars: [],
|
||||
UserId: 0,
|
||||
UserName: "",
|
||||
}
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name)).toString()
|
||||
let restore = localstoreService.get(this.keyName, {})
|
||||
this._user = restore.user || new User()
|
||||
|
||||
}
|
||||
|
||||
get user(): User {
|
||||
return this._user || new User()
|
||||
}
|
||||
|
||||
reset(user) {
|
||||
this._user = user
|
||||
|
||||
this.save(this._user)
|
||||
}
|
||||
|
||||
private save(user) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyName,{
|
||||
user,
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const UserStore = new UserService()
|
||||
+6
-1
@@ -1071,7 +1071,7 @@ ngx-mat-datetime-content{
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 1024px) {
|
||||
@media only screen and (max-width: 767px) {
|
||||
.calendar-segment-mdgpr:not(.calendar-segment-pr-force) {
|
||||
.calendar-pr-event-type-Oficial {
|
||||
border-right: 3px solid transparent !important;
|
||||
@@ -1090,3 +1090,8 @@ ngx-mat-datetime-content{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.modal-background {
|
||||
background: #0000006b;
|
||||
}
|
||||
Reference in New Issue
Block a user