mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
85979: only show security tab on profile page when canChangePassword FeatureID is true
This commit is contained in:
@@ -13,6 +13,7 @@ export enum FeatureID {
|
||||
CanManageGroup = 'canManageGroup',
|
||||
IsCollectionAdmin = 'isCollectionAdmin',
|
||||
IsCommunityAdmin = 'isCommunityAdmin',
|
||||
CanChangePassword = 'canChangePassword',
|
||||
CanDownload = 'canDownload',
|
||||
CanRequestACopy = 'canRequestACopy',
|
||||
CanManageVersions = 'canManageVersions',
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<ds-profile-page-metadata-form [user]="user"></ds-profile-page-metadata-form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mb-4">
|
||||
<div *ngIf="canChangePassword$ | async" class="card mb-4">
|
||||
<div class="card-header">{{'profile.card.security' | translate}}</div>
|
||||
<div class="card-body">
|
||||
<ds-profile-page-security-form
|
||||
|
@@ -18,6 +18,8 @@ import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||
import { followLink } from '../shared/utils/follow-link-config.model';
|
||||
import { AuthService } from '../core/auth/auth.service';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service';
|
||||
import { FeatureID } from '../core/data/feature-authorization/feature-id';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-profile-page',
|
||||
@@ -67,11 +69,13 @@ export class ProfilePageComponent implements OnInit {
|
||||
* The authenticated user
|
||||
*/
|
||||
private currentUser: EPerson;
|
||||
canChangePassword$: Observable<boolean>;
|
||||
|
||||
constructor(private authService: AuthService,
|
||||
private notificationsService: NotificationsService,
|
||||
private translate: TranslateService,
|
||||
private epersonService: EPersonDataService) {
|
||||
private epersonService: EPersonDataService,
|
||||
private authorizationService: AuthorizationDataService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -83,6 +87,7 @@ export class ProfilePageComponent implements OnInit {
|
||||
tap((user: EPerson) => this.currentUser = user)
|
||||
);
|
||||
this.groupsRD$ = this.user$.pipe(switchMap((user: EPerson) => user.groups));
|
||||
this.canChangePassword$ = this.user$.pipe(switchMap((user:EPerson) => this.authorizationService.isAuthorized(FeatureID.CanChangePassword, user._links.self.href)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user