Skip to content

Commit

Permalink
Merge pull request #451 from bcgov/fix-bulknotice-and-bulktakedown-bu…
Browse files Browse the repository at this point in the history
…ttons

Fixed permission check for Bulk-Takedown and Bulk-Notice components
  • Loading branch information
ychung-mot authored Jul 2, 2024
2 parents 50bca34 + 5f5fad8 commit 8d97976
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { UserDataService } from '../../../../common/services/user-data.service';
import { environment } from '../../../../../environments/environment';
import { SelectedListingsStateService } from '../../../../common/services/selected-listings-state.service';
import { GlobalLoaderService } from '../../../../common/services/global-loader.service';
import { listing_read, takedown_action } from '../../../../common/consts/permissions.const';

@Component({
selector: 'app-listing-details',
Expand Down Expand Up @@ -50,7 +51,7 @@ export class ListingDetailsComponent implements OnInit {

this.userDataService.getCurrentUser().subscribe({
next: (user) => {
this.isCEU = user.permissions.includes('ceu_action');
this.isCEU = !user.permissions.includes(takedown_action);
}, complete: () => {
this.loaderService.loadingEnd();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { PanelModule } from 'primeng/panel';
import { DropdownOption } from '../../../common/models/dropdown-option';
import { UserDataService } from '../../../common/services/user-data.service';
import { User } from '../../../common/models/user';
import { ceu_action } from '../../../common/consts/permissions.const';
import { takedown_action } from '../../../common/consts/permissions.const';
import { ListingDetailsComponent } from './listing-details/listing-details.component';
import { ListingSearchRequest } from '../../../common/models/listing-search-request';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
Expand Down Expand Up @@ -110,7 +110,7 @@ export class ListingsTableComponent implements OnInit {

this.userService.getCurrentUser().subscribe({
next: (currentUser: User) => {
this.isCEU = currentUser.permissions.includes(ceu_action);
this.isCEU = !currentUser.permissions.includes(takedown_action);
this.getListings(page);
},
});
Expand Down

0 comments on commit 8d97976

Please sign in to comment.