remove keycloak
This commit is contained in:
@@ -4,7 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { initFlowbite } from 'flowbite';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
|
||||
import { NgxCurrencyDirective } from 'ngx-currency';
|
||||
import { ImageCropperComponent } from 'ngx-image-cropper';
|
||||
import { QuillModule } from 'ngx-quill';
|
||||
@@ -34,7 +34,7 @@ import { SharedService } from '../../../services/shared.service';
|
||||
import { SubscriptionsService } from '../../../services/subscriptions.service';
|
||||
import { UserService } from '../../../services/user.service';
|
||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||
import { checkAndUpdate, map2User } from '../../../utils/utils';
|
||||
import { checkAndUpdate, isAdmin, map2User } from '../../../utils/utils';
|
||||
import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
||||
@Component({
|
||||
selector: 'app-account',
|
||||
@@ -89,7 +89,6 @@ export class AccountComponent {
|
||||
private loadingService: LoadingService,
|
||||
private imageUploadService: ImageService,
|
||||
private imageService: ImageService,
|
||||
private keycloakService: KeycloakService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private messageService: MessageService,
|
||||
private sharedService: SharedService,
|
||||
@@ -107,7 +106,6 @@ export class AccountComponent {
|
||||
if (this.id) {
|
||||
this.user = await this.userService.getById(this.id);
|
||||
} else {
|
||||
// const token = await this.keycloakService.getToken();
|
||||
const token = await this.authService.getToken();
|
||||
const keycloakUser = map2User(token);
|
||||
const email = keycloakUser.email;
|
||||
@@ -268,7 +266,7 @@ export class AccountComponent {
|
||||
return message ? message.message : '';
|
||||
}
|
||||
isAdmin() {
|
||||
return this.keycloakService.getUserRoles(true).includes('ADMIN');
|
||||
return isAdmin(this.user.email);
|
||||
}
|
||||
setState(index: number, state: string) {
|
||||
if (state === null) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { map2User, routeListingWithState } from '../../../utils/utils';
|
||||
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { QuillModule } from 'ngx-quill';
|
||||
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
@@ -86,7 +85,6 @@ export class EditBusinessListingComponent {
|
||||
private loadingService: LoadingService,
|
||||
private messageService: MessageService,
|
||||
private route: ActivatedRoute,
|
||||
private keycloakService: KeycloakService,
|
||||
private validationMessagesService: ValidationMessagesService,
|
||||
private authService: AuthService,
|
||||
) {
|
||||
@@ -105,7 +103,6 @@ export class EditBusinessListingComponent {
|
||||
});
|
||||
}
|
||||
async ngOnInit() {
|
||||
// const token = await this.keycloakService.getToken();
|
||||
const token = await this.authService.getToken();
|
||||
const keycloakUser = map2User(token);
|
||||
this.listingUser = await this.userService.getByMail(keycloakUser.email);
|
||||
|
||||
@@ -9,7 +9,6 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { ViewportRuler } from '@angular/cdk/scrolling';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { NgxCurrencyDirective } from 'ngx-currency';
|
||||
import { ImageCropperComponent } from 'ngx-image-cropper';
|
||||
import { QuillModule } from 'ngx-quill';
|
||||
@@ -123,7 +122,6 @@ export class EditCommercialPropertyListingComponent {
|
||||
private loadingService: LoadingService,
|
||||
|
||||
private route: ActivatedRoute,
|
||||
private keycloakService: KeycloakService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private confirmationService: ConfirmationService,
|
||||
private messageService: MessageService,
|
||||
@@ -147,7 +145,6 @@ export class EditCommercialPropertyListingComponent {
|
||||
});
|
||||
}
|
||||
async ngOnInit() {
|
||||
// const token = await this.keycloakService.getToken();
|
||||
const token = await this.authService.getToken();
|
||||
const keycloakUser = map2User(token);
|
||||
const email = keycloakUser.email;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
|
||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ErrorResponse, KeycloakUser, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { MessageService } from '../../../components/message/message.service';
|
||||
@@ -31,7 +29,6 @@ export class EmailUsComponent {
|
||||
constructor(
|
||||
private mailService: MailService,
|
||||
private userService: UserService,
|
||||
public keycloakService: KeycloakService,
|
||||
private validationMessagesService: ValidationMessagesService,
|
||||
private messageService: MessageService,
|
||||
public selectOptions: SelectOptionsService,
|
||||
@@ -41,7 +38,6 @@ export class EmailUsComponent {
|
||||
this.mailinfo = createMailInfo();
|
||||
}
|
||||
async ngOnInit() {
|
||||
// const token = await this.keycloakService.getToken();
|
||||
const token = await this.authService.getToken();
|
||||
this.keycloakUser = map2User(token);
|
||||
if (this.keycloakUser) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { BusinessListing, CommercialPropertyListing } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { KeycloakUser } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
|
||||
@@ -21,15 +20,8 @@ export class FavoritesComponent {
|
||||
user: KeycloakUser;
|
||||
// listings: Array<ListingType> = []; //= dataListings as unknown as Array<BusinessListing>;
|
||||
favorites: Array<BusinessListing | CommercialPropertyListing>;
|
||||
constructor(
|
||||
public keycloakService: KeycloakService,
|
||||
private listingsService: ListingsService,
|
||||
public selectOptions: SelectOptionsService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
constructor(private listingsService: ListingsService, public selectOptions: SelectOptionsService, private confirmationService: ConfirmationService, private authService: AuthService) {}
|
||||
async ngOnInit() {
|
||||
// const token = await this.keycloakService.getToken();
|
||||
const token = await this.authService.getToken();
|
||||
this.user = map2User(token);
|
||||
const result = await Promise.all([await this.listingsService.getFavoriteListings('business'), await this.listingsService.getFavoriteListings('commercialProperty')]);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
|
||||
@@ -27,7 +26,6 @@ export class MyListingComponent {
|
||||
user: User;
|
||||
constructor(
|
||||
public userService: UserService,
|
||||
public keycloakService: KeycloakService,
|
||||
private listingsService: ListingsService,
|
||||
private cdRef: ChangeDetectorRef,
|
||||
public selectOptions: SelectOptionsService,
|
||||
@@ -36,8 +34,6 @@ export class MyListingComponent {
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
async ngOnInit() {
|
||||
// const keycloakUser = this.userService.getKeycloakUser();
|
||||
// const token = await this.keycloakService.getToken();
|
||||
const token = await this.authService.getToken();
|
||||
const keycloakUser = map2User(token);
|
||||
const email = keycloakUser.email;
|
||||
@@ -62,14 +58,5 @@ export class MyListingComponent {
|
||||
// this.messageService.showMessage('Listing has been deleted');
|
||||
this.deleteListing(listing);
|
||||
}
|
||||
// this.confirmationService.confirm({
|
||||
// target: event.target as EventTarget,
|
||||
// message: 'Are you sure you want to delet this listing?',
|
||||
// icon: 'pi pi-exclamation-triangle',
|
||||
// accept: () => {
|
||||
// this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing has been deleted', life: 3000 });
|
||||
// this.deleteListing(listing);
|
||||
// },
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user