[Connect|Trunk]

- Robots.txt: remove files, generate them through server.ts
- add isCommunity in community related pages
- update properties for connect-login in beta



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60016 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-12-02 17:41:53 +00:00
parent b873aebcee
commit f55a302878
10 changed files with 78 additions and 78 deletions

View File

@ -17,8 +17,7 @@
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/robots.txt"
"src/assets"
],
"styles": [
"src/styles.css",
@ -49,10 +48,6 @@
{
"replace": "src/index.html",
"with": "src/index.prod.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.prod.txt"
}
]
},
@ -74,10 +69,6 @@
{
"replace": "src/index.html",
"with": "src/index.beta.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.beta.txt"
}
]
},
@ -134,8 +125,7 @@
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"assets": [
"src/assets",
"src/robots.txt"
"src/assets"
]
}
},
@ -168,10 +158,6 @@
{
"replace": "src/index.html",
"with": "src/index.prod.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.prod.txt"
}
]
},
@ -184,10 +170,6 @@
{
"replace": "src/index.html",
"with": "src/index.beta.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.beta.txt"
}
]
},

View File

@ -81,7 +81,6 @@ app.use(function (req, res, next) {
});
// - Serve sitemap based on the host -
app.get('/sitemap.xml', (req, res) => {
console.log(req.get("host"));
let host = req.get("host").split(":")[0];
let connectLinks= ["/","/about/learn-how","/about/learn-in-depth", "/about/faq","/search/find/communities"];
let communityLinks= ["/","/search/find/research-outcomes?size=20","/search/advanced/research-outcomes?size=20","/participate/deposit/learn-how","/organizations", "/content"];
@ -98,6 +97,31 @@ app.use(function (req, res, next) {
res.setHeader('content-type', 'application/xml');
res.send( sitemap);
});
app.get('/robots.txt', (req, res) => {
let host = req.get("host").split(":")[0];
let robots = "";
if(host.indexOf(".openaire.eu") != -1 && host.indexOf("beta.") == -1 ){
//link to disallow
let connectLinks= ["/about/*","/search/find/communities"];
let communityLinks= ["/search/advanced/*","/participate/*",
"/search/project",'/search/result', '/search/publication', '/search/dataset','/search/software','/search/other','/search/dataprovider','/search/organization','/project-report',
'/search/find/publications','/search/find/datasets','/search/find/software','/search/find/other','/search/find/projects','/search/find/dataproviders','/search/find/research-outcomes'
];
robots = "User-Agent: *\n"+
"Crawl-delay: 30\n" +
"Sitemap: /sitemap.xml\n";
for(let link of (host.indexOf("connect.openaire.eu") == -1 ?connectLinks:communityLinks)){
robots += "Disallow: " + link + "\n";
}
}else{
robots = "User-Agent: *\n" +
"Disallow: /\n"
}
res.setHeader('content-type', 'text/plain');
res.send( robots);
});
/* - Example Express Rest API endpoints -
app.get('/api/**', (req, res) => { });

View File

@ -6,6 +6,7 @@ import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/en
import { OpenaireErrorPageComponent } from './error/errorPage.component';
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
const routes: Routes = [
// Other Pages
@ -18,13 +19,13 @@ const routes: Routes = [
{ path: 'contact-us', loadChildren: './contact/contact.module#ContactModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'verify/:id', loadChildren: './verification-manager/verification-manager.module#VerificationManagerModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'publications', loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'projects', loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'national-bulletins', loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'publications', loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'projects', loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'national-bulletins', loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'myCommunities', loadChildren: './my-communities/my-communities.module#MyCommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
@ -32,14 +33,14 @@ const routes: Routes = [
{ path: 'helper-test', loadChildren: './helper-test/helper-test.module#HelperTestModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
// Landing Pages
{ path: 'search/result', loadChildren: './landingPages/result/libResult.module#LibResultModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/project', loadChildren: './landingPages/project/libProject.module#LibProjectModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/dataprovider', loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/organization', loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/result', loadChildren: './landingPages/result/libResult.module#LibResultModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/project', loadChildren: './landingPages/project/libProject.module#LibProjectModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/dataprovider', loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/organization', loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'project-report', loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
@ -47,40 +48,41 @@ const routes: Routes = [
{ path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'},
{ path: 'search/find/communities', loadChildren: './searchPages/communities/searchCommunities.module#SearchCommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/find/research-outcomes', loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/find/publications', component: PageURLResolverComponent},
{ path: 'search/find/datasets', component: PageURLResolverComponent},
{ path: 'search/find/software', component: PageURLResolverComponent},
{ path: 'search/find/other', component: PageURLResolverComponent},
{ path: 'search/find/projects', loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/find/dataproviders', loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/find/research-outcomes', loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/find/publications', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/find/datasets', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/find/software', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/find/other', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/find/projects', loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/find/dataproviders', loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
// Advanced Search Pages
{ path: 'search/advanced/research-outcomes', loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/advanced/publications', component: PageURLResolverComponent},
{ path: 'search/advanced/datasets', component: PageURLResolverComponent},
{ path: 'search/advanced/software', component: PageURLResolverComponent},
{ path: 'search/advanced/other', component: PageURLResolverComponent},
{ path: 'search/advanced/organizations', loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/advanced/dataproviders', loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/advanced/projects', loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/advanced/research-outcomes', loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/advanced/datasets', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/advanced/software', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/advanced/other', component: PageURLResolverComponent, canActivate:[IsCommunity]},
{ path: 'search/advanced/organizations', loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/advanced/dataproviders', loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'search/advanced/projects', loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
// Deposit Pages
{ path: 'participate/deposit-datasets', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{ path: 'participate/deposit-datasets-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{ path: 'participate/deposit-subject-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{ path: 'participate/deposit-publications', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{ path: 'participate/deposit-publications-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{ path: 'participate/share-zenodo', redirectTo: '/participate/deposit/zenodo', pathMatch: 'full'},
{ path: 'participate/deposit-datasets', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]},
{ path: 'participate/deposit-datasets-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]},
{ path: 'participate/deposit-subject-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]},
{ path: 'participate/deposit-publications', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]},
{ path: 'participate/deposit-publications-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]},
{ path: 'participate/share-zenodo', redirectTo: '/participate/deposit/zenodo', pathMatch: 'full', canActivate:[IsCommunity]},
{ path: 'participate/deposit/learn-how', loadChildren: './deposit/deposit.module#LibDepositModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'participate/deposit/search', loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'participate/deposit/zenodo', loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'participate/deposit/learn-how', loadChildren: './deposit/deposit.module#LibDepositModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'participate/deposit/search', loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'participate/deposit/zenodo', loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
// Linking Pages
{ path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
{ path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule', resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate:[IsCommunity]},
// help pages - do not exist in Admin portal/api/db
{ path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule', resolve: { envSpecific: EnvironmentSpecificResolver }},

View File

@ -177,7 +177,7 @@ export class AppComponent {
break;
}
if (this.user && com['status'] != "hidden") {
if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || Session.isManager('community', this.communityId, this.user)) {
if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) ||(this.communityId && Session.isManager('community', this.communityId, this.user))) {
this.managerOfCommunities = true;
} else if (com.managers.indexOf(this.user.email) != -1) {
this.managerOfCommunities = true;
@ -186,7 +186,7 @@ export class AppComponent {
if (communityId && communityId != "" && com.communityId == communityId) {
community = com;
let isCommunityManager: boolean = false;
if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || Session.isManager('community', this.communityId, this.user)) {
if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user))) {
isCommunityManager = true;
} else if (this.user && com.managers.indexOf(this.user.email) != -1) {
isCommunityManager = true;

View File

@ -28,6 +28,7 @@ import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.mod
import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service";
import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service";
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
@NgModule({
@ -51,7 +52,7 @@ import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.servi
declarations: [ AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ],
providers:[
EnvironmentSpecificResolver, CommunitiesService, LayoutService, SubscribeService,
EnvironmentSpecificResolver, CommunitiesService, LayoutService, SubscribeService, IsCommunity,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,

View File

@ -49,12 +49,11 @@ export let properties: EnvProperties = {
piwikBaseUrl: "https://analytics.openaire.eu/piwik.php?idsite=",
piwikSiteId: "80",
loginUrl: "https://beta.services.openaire.eu/connect-user-management/openid_connect_login",
loginUrl: "https://beta.services.openaire.eu/connect-login/openid_connect_login",
userInfoUrl: "https://beta.services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=",
registryUrl: 'https://beta.services.openaire.eu/uoa-user-management/api/registry/',
logoutUrl: "https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
logoutUrl: "https://beta.services.openaire.eu/connect-login/openid_logout",
cookieDomain: ".openaire.eu",
feedbackmail: "feedback@openaire.eu",

View File

@ -54,7 +54,7 @@ export let properties: EnvProperties = {
userInfoUrl: " https://services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=",
registryUrl: 'https://services.openaire.eu/uoa-user-management/api/registry/',
logoutUrl: "https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
// logoutUrl: "https://services.openaire.eu/connect-user-management/openid_logout",
cookieDomain: ".openaire.eu",
feedbackmail: "feedback@openaire.eu",

View File

@ -1,2 +0,0 @@
User-Agent: *
Disallow: /

View File

@ -1,4 +0,0 @@
User-Agent: *
Crawl-delay: 30
Sitemap: /sitemap.xml

View File

@ -1,2 +0,0 @@
User-Agent: *
Disallow: /