Fix role verification for community members. Modify isPrivate in communityHelper to include membership.
This commit is contained in:
parent
c29488545e
commit
ff4411d695
|
@ -1,6 +1,7 @@
|
||||||
import {HttpParams} from '@angular/common/http';
|
import {HttpParams} from '@angular/common/http';
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
import {Session} from "../login/utils/helper.class";
|
import {Session} from "../login/utils/helper.class";
|
||||||
|
import {CommunityInfo} from "./community/communityInfo";
|
||||||
|
|
||||||
export class ConnectHelper {
|
export class ConnectHelper {
|
||||||
|
|
||||||
|
@ -53,7 +54,12 @@ export class ConnectHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static isPrivate(community, user) {
|
public static isPrivate(community: CommunityInfo, user) {
|
||||||
return community && (community.isPrivate() || (community.isRestricted() && !(Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, user))))
|
return community && (community.isPrivate() || (community.isRestricted() && !(
|
||||||
|
Session.isPortalAdministrator(user) ||
|
||||||
|
Session.isCommunityCurator(user) ||
|
||||||
|
Session.isManager("community", community.communityId, user) ||
|
||||||
|
(!community.isOpen() && Session.isMember('community', community.communityId, user))
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import {ClearCacheService} from "../services/clear-cache.service";
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #memberModal [overflowBody]="false" *ngIf="service == 'monitor'" (cancelOutput)="cancel()"
|
<modal-alert #memberModal [overflowBody]="false" (cancelOutput)="cancel()"
|
||||||
(alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading) && !isMember">
|
(alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading) && !isMember">
|
||||||
<div *ngIf="!isMember">
|
<div *ngIf="!isMember">
|
||||||
<div>
|
<div>
|
||||||
|
@ -119,12 +119,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
if (this.paramsSubscription instanceof Subscription) {
|
|
||||||
this.paramsSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
this.paramsSubscription = this.route.queryParams.subscribe(params => {
|
this.paramsSubscription = this.route.queryParams.subscribe(params => {
|
||||||
if (params) {
|
if (params) {
|
||||||
this.isMember = !!params['isMember'];
|
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
if(params['verify'] && !this.isMember) {
|
if(params['verify'] && !this.isMember) {
|
||||||
if (this.user) {
|
if (this.user) {
|
||||||
|
@ -133,7 +129,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
|
||||||
if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) {
|
if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) {
|
||||||
if (this.verification.verificationType === 'manager') {
|
if (this.verification.verificationType === 'manager') {
|
||||||
this.openManagerModal();
|
this.openManagerModal();
|
||||||
} else if (this.verification.verificationType === 'member' && this.service === "monitor") {
|
} else if (this.verification.verificationType === 'member') {
|
||||||
this.openMemberModal();
|
this.openMemberModal();
|
||||||
} else {
|
} else {
|
||||||
this.openErrorModal();
|
this.openErrorModal();
|
||||||
|
@ -217,6 +213,9 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
|
||||||
this.managerModal.cancel();
|
this.managerModal.cancel();
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.userManagementService.updateUserInfo(() => {
|
this.userManagementService.updateUserInfo(() => {
|
||||||
|
if (this.paramsSubscription instanceof Subscription) {
|
||||||
|
this.paramsSubscription.unsubscribe();
|
||||||
|
}
|
||||||
if (this.service === "monitor") {
|
if (this.service === "monitor") {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.router.navigate(['/admin/' + this.verification.entity]);
|
this.router.navigate(['/admin/' + this.verification.entity]);
|
||||||
|
@ -254,8 +253,12 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
|
||||||
this.clearCacheService.clearCache('Members updated');
|
this.clearCacheService.clearCache('Members updated');
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
this.isMember = true;
|
||||||
this.userManagementService.updateUserInfo(() => {
|
this.userManagementService.updateUserInfo(() => {
|
||||||
this.router.navigate([], {queryParams: {'verify': null, 'isMember': true}});
|
if (this.paramsSubscription instanceof Subscription) {
|
||||||
|
this.paramsSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
this.cancel();
|
||||||
});
|
});
|
||||||
}, error => {
|
}, error => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
@ -271,6 +274,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.router.navigate([], {queryParams: {'verify': null, 'isMember': null}});
|
this.isMember = false;
|
||||||
|
this.router.navigate([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue