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:
@@ -132,6 +132,8 @@ export class AuthService {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
this.initialsService.getInitials(session.FullName);
|
||||
}
|
||||
|
||||
//Login to rocketChat server2
|
||||
@@ -298,8 +300,8 @@ export class AuthService {
|
||||
this.userData$.next('');
|
||||
this.router.navigate(['']);
|
||||
}) */
|
||||
|
||||
}
|
||||
|
||||
async presentAlert(message: string) {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
|
||||
@@ -6,6 +6,7 @@ import { StorageService } from './storage.service';
|
||||
import { HttpClient, HttpHeaderResponse } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { PermissionService } from './permission.service';
|
||||
|
||||
|
||||
@Injectable({
|
||||
@@ -29,15 +30,19 @@ export class ChatService {
|
||||
private authService: AuthService,
|
||||
private storage: Storage,
|
||||
private storageService:StorageService,
|
||||
public p: PermissionService,
|
||||
)
|
||||
{
|
||||
this.loggedUserChat = authService.ValidatedUserChat;
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
|
||||
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
|
||||
if(this.p.userPermission(this.p.permissionList.Chat.access)) {
|
||||
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
|
||||
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,23 @@ export class PermissionService {
|
||||
return false;
|
||||
}
|
||||
|
||||
userPermissionCount(args) {
|
||||
if(!Array.isArray(args)) {
|
||||
args = [args]
|
||||
}
|
||||
|
||||
let count = 0
|
||||
|
||||
for(let permission of (this.SessionStore.user.UserPermissions || [])) {
|
||||
if (args.includes(permission)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
role(args: any) {
|
||||
|
||||
let UserRoleIsValid = this.userRole(args)
|
||||
|
||||
Reference in New Issue
Block a user