Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngOnInit() {
this.projectId = this.route.snapshot.parent.params['id'];
const permissions = [
{ resource: USERSTATICPERMISSION.MEMBER.KEY, action: USERSTATICPERMISSION.MEMBER.VALUE.LIST },
{ resource: USERSTATICPERMISSION.QUOTA.KEY, action: USERSTATICPERMISSION.QUOTA.VALUE.READ },
];
this.userPermissionService.hasProjectPermissions(this.projectId, permissions).subscribe((results: Array) => {
this.showProjectMemberInfo = results[0];
this.showQuotaInfo = results[1];
});
this.projectService.getProjectSummary(this.projectId).subscribe(res => {
this.summaryInformation = res;
}, error => {
this.errorHandler.error(error);
});
}
getMemberPermissionRule(projectId: number): void {
let hasCreateMemberPermission = this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.MEMBER.KEY, USERSTATICPERMISSION.MEMBER.VALUE.CREATE);
let hasUpdateMemberPermission = this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.MEMBER.KEY, USERSTATICPERMISSION.MEMBER.VALUE.UPDATE);
let hasDeleteMemberPermission = this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.MEMBER.KEY, USERSTATICPERMISSION.MEMBER.VALUE.DELETE);
forkJoin(hasCreateMemberPermission, hasUpdateMemberPermission, hasDeleteMemberPermission).subscribe(MemberRule => {
this.hasCreateMemberPermission = MemberRule[0] as boolean;
this.hasUpdateMemberPermission = MemberRule[1] as boolean;
this.hasDeleteMemberPermission = MemberRule[2] as boolean;
}, error => this.errorHandler.error(error));
}
}
getMemberPermissionRule(projectId: number): void {
let hasCreateMemberPermission = this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.MEMBER.KEY, USERSTATICPERMISSION.MEMBER.VALUE.CREATE);
let hasUpdateMemberPermission = this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.MEMBER.KEY, USERSTATICPERMISSION.MEMBER.VALUE.UPDATE);
let hasDeleteMemberPermission = this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.MEMBER.KEY, USERSTATICPERMISSION.MEMBER.VALUE.DELETE);
forkJoin(hasCreateMemberPermission, hasUpdateMemberPermission, hasDeleteMemberPermission).subscribe(MemberRule => {
this.hasCreateMemberPermission = MemberRule[0] as boolean;
this.hasUpdateMemberPermission = MemberRule[1] as boolean;
this.hasDeleteMemberPermission = MemberRule[2] as boolean;
}, error => this.errorHandler.error(error));
}
}