diff --git a/connect/connectHelper.ts b/connect/connectHelper.ts index 0e65047a..d53a63a3 100644 --- a/connect/connectHelper.ts +++ b/connect/connectHelper.ts @@ -1,6 +1,7 @@ import {HttpParams} from '@angular/common/http'; import {properties} from "../../../environments/environment"; import {Session} from "../login/utils/helper.class"; +import {CommunityInfo} from "./community/communityInfo"; export class ConnectHelper { @@ -53,7 +54,12 @@ export class ConnectHelper { } - public static isPrivate(community, user) { - return community && (community.isPrivate() || (community.isRestricted() && !(Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, 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) || + (!community.isOpen() && Session.isMember('community', community.communityId, user)) + ))) } } diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index 9030d636..c4a9a71a 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -34,7 +34,7 @@ import {ClearCacheService} from "../services/clear-cache.service"; -
@@ -119,12 +119,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn ngAfterViewInit() { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; - if (this.paramsSubscription instanceof Subscription) { - this.paramsSubscription.unsubscribe(); - } this.paramsSubscription = this.route.queryParams.subscribe(params => { if (params) { - this.isMember = !!params['isMember']; this.cdr.detectChanges(); if(params['verify'] && !this.isMember) { 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.verification.verificationType === 'manager') { this.openManagerModal(); - } else if (this.verification.verificationType === 'member' && this.service === "monitor") { + } else if (this.verification.verificationType === 'member') { this.openMemberModal(); } else { this.openErrorModal(); @@ -217,6 +213,9 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.managerModal.cancel(); this.error = null; this.userManagementService.updateUserInfo(() => { + if (this.paramsSubscription instanceof Subscription) { + this.paramsSubscription.unsubscribe(); + } if (this.service === "monitor") { this.loading = false; this.router.navigate(['/admin/' + this.verification.entity]); @@ -254,8 +253,12 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.clearCacheService.clearCache('Members updated'); this.loading = false; this.error = null; + this.isMember = true; this.userManagementService.updateUserInfo(() => { - this.router.navigate([], {queryParams: {'verify': null, 'isMember': true}}); + if (this.paramsSubscription instanceof Subscription) { + this.paramsSubscription.unsubscribe(); + } + this.cancel(); }); }, error => { this.loading = false; @@ -271,6 +274,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn } cancel() { - this.router.navigate([], {queryParams: {'verify': null, 'isMember': null}}); + this.isMember = false; + this.router.navigate([]); } } diff --git a/utils/properties/environments/environment.all.ts b/utils/properties/environments/environment.all.ts new file mode 100644 index 00000000..020b7e89 --- /dev/null +++ b/utils/properties/environments/environment.all.ts @@ -0,0 +1,25 @@ +import {EnvProperties} from "../env-properties"; + +export let common: EnvProperties = { + swhURL: "https://archive.softwareheritage.org/", + // searchCrossrefAPIURL: "https://api.crossref.org/works", + // searchDataciteAPIURL: "https://api.datacite.org/works", + // searchOrcidURL: "https://pub.orcid.org/v2.1/", + // orcidURL: "https://orcid.org/", + // doiURL: "https://doi.org/", + // pmcURL: "http://europepmc.org/articles/", + // pmidURL: "https://www.ncbi.nlm.nih.gov/pubmed/", + // handleURL: "http://hdl.handle.net/", + // cordisURL: "http://cordis.europa.eu/projects/", + // openDoarURL: "http://v2.sherpa.ac.uk/id/repository/", + // r3DataURL: "http://service.re3data.org/repository/", + // fairSharingURL: "https://fairsharing.org/", + // sherpaURL: "http://sherpa.ac.uk/romeo/issn/", + // sherpaURLSuffix: "/", + // zenodo: "https://zenodo.org/", + // openAccess: "https://www.openaire.eu/support/faq#article-id-234", + // openAccessRepo: "https://www.openaire.eu/support/faq#article-id-310", + // fp7Guidlines: "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme", + // h2020Guidlines: "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020", + // ercGuidlines: "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.beta.ts b/utils/properties/environments/environment.beta.ts new file mode 100644 index 00000000..520b88e2 --- /dev/null +++ b/utils/properties/environments/environment.beta.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonBeta: EnvProperties = { + // searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/", + // searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.prod.ts b/utils/properties/environments/environment.prod.ts new file mode 100644 index 00000000..a2aa22f8 --- /dev/null +++ b/utils/properties/environments/environment.prod.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonProd: EnvProperties = { + // searchAPIURLLAst: "https://services.openaire.eu/search/v2/api/", + // searchResourcesAPIURL: "https://services.openaire.eu/search/v2/api/resources", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.test.ts b/utils/properties/environments/environment.test.ts new file mode 100644 index 00000000..81abb978 --- /dev/null +++ b/utils/properties/environments/environment.test.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonTest: EnvProperties = { + // searchAPIURLLAst: "https://services.openaire.eu/shadowSearch/v2/api/", + // searchResourcesAPIURL: "https://services.openaire.eu/shadowSearch/v2/api/resources", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.ts b/utils/properties/environments/environment.ts new file mode 100644 index 00000000..69e7ceb1 --- /dev/null +++ b/utils/properties/environments/environment.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonDev: EnvProperties = { + // searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/", + // searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", +} \ No newline at end of file