[master | FIXED]: Fix guards for curators. Fix loading when a subcategory is changed in RPO, RFO, repo.
This commit is contained in:
parent
6d4dec260b
commit
75ab0d247e
|
@ -122,6 +122,6 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
public get isAdmin() {
|
||||
return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user);
|
||||
return Session.isPortalAdministrator(this.user) || Session.isCurator(this.stakeholder.type, this.user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import {SideBarModule} from "../openaireLibrary/dashboard/sharedComponents/sideb
|
|||
import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module";
|
||||
import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.module";
|
||||
import {AdminLoginGuard} from "../openaireLibrary/login/adminLoginGuard.guard";
|
||||
import {LoginGuard} from "../openaireLibrary/login/loginGuard.guard";
|
||||
import {AdminDashboardGuard} from "../openaireLibrary/monitor-admin/utils/adminDashboard.guard";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild([
|
||||
|
@ -14,6 +16,7 @@ import {AdminLoginGuard} from "../openaireLibrary/login/adminLoginGuard.guard";
|
|||
path: '', component: AdminComponent, children: [
|
||||
{
|
||||
path: '',
|
||||
canActivateChild: [LoginGuard],
|
||||
loadChildren: () => import('../openaireLibrary/monitor-admin/manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule),
|
||||
data: {hasAdminMenu: true, hasSidebar: false}
|
||||
},
|
||||
|
@ -24,7 +27,9 @@ import {AdminLoginGuard} from "../openaireLibrary/login/adminLoginGuard.guard";
|
|||
data: {hasAdminMenu: true, hasSidebar: false}
|
||||
},
|
||||
{
|
||||
path: ':stakeholder', children: [
|
||||
path: ':stakeholder',
|
||||
canActivateChild: [AdminDashboardGuard],
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('../openaireLibrary/monitor-admin/general/general.module').then(m => m.GeneralModule)
|
||||
|
|
|
@ -69,8 +69,8 @@ const routes: Routes = [
|
|||
{
|
||||
path: 'admin',
|
||||
loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule),
|
||||
data: {title: Irish.METADATA_PREFIX + ' Admin | ', monitorCurator: true},
|
||||
canActivateChild: [AdminLoginGuard, HasConsentGuard]
|
||||
data: {title: Irish.METADATA_PREFIX + ' Admin | '},
|
||||
canActivateChild: [HasConsentGuard]
|
||||
},
|
||||
{path: 'user-policy', loadChildren: () => import('./user-policy/user-policy.module').then(m => m.UserPolicyModule)},
|
||||
{path: 'participate', loadChildren: () => import('./claims/claims.module').then(m => m.ClaimsModule), canActivate: [HasConsentGuard]},
|
||||
|
|
|
@ -237,7 +237,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
|
|||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {},null, null, "uk-visible@m"));
|
||||
}
|
||||
if (this.isAdmin) {
|
||||
if(Session.isPortalAdministrator(this.user) || Session.isCurator('country', this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {},null, null, "uk-visible@m"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ae4b3b7b95b588e2c774109b7b3ff4275aec2de6
|
||||
Subproject commit 037c32c545c772c06f8a7a9a5d1da84d95b96522
|
|
@ -134,28 +134,30 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
|
|||
this._customFilterService.setCustomFilter(null);
|
||||
this.alias = params['stakeholder'];
|
||||
if (this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder && this.stakeholder.type === 'datasource') {
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("repository/" + this.stakeholder.alias);
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("Repository", "collectedfromdatasourceid", this.stakeholder.index_id, this.stakeholder.index_name, true)
|
||||
]);
|
||||
this.subscriptions.push(this.searchDataprovidersService.searchDataproviderById(this.stakeholder.index_id).subscribe(data => {
|
||||
this.stakeholder.details = data[0];
|
||||
this.subscriptions.push(this.userManagementService.getUserInfoAt(1).subscribe(user => {
|
||||
this.isProvideManager = !!user.role.find(role => role.includes(this.stakeholder.details.originalId.toUpperCase()));
|
||||
if(this.stakeholder?.alias !== this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder && this.stakeholder.type === 'datasource') {
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("repository/" + this.stakeholder.alias);
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("Repository", "collectedfromdatasourceid", this.stakeholder.index_id, this.stakeholder.index_name, true)
|
||||
]);
|
||||
this.subscriptions.push(this.searchDataprovidersService.searchDataproviderById(this.stakeholder.index_id).subscribe(data => {
|
||||
this.stakeholder.details = data[0];
|
||||
this.subscriptions.push(this.userManagementService.getUserInfoAt(1).subscribe(user => {
|
||||
this.isProvideManager = !!user.role.find(role => role.includes(this.stakeholder.details.originalId.toUpperCase()));
|
||||
}));
|
||||
this.loading = false;
|
||||
}));
|
||||
this.loading = false;
|
||||
}));
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
}
|
||||
|
|
|
@ -99,23 +99,25 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
|
|||
this._customFilterService.setCustomFilter(null);
|
||||
this.alias = params['stakeholder'];
|
||||
if (this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder && this.stakeholder.type === 'funder') {
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("rfo/" + this.stakeholder.alias);
|
||||
let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("RF0", "relfunder", value, this.stakeholder.index_name, true)
|
||||
]);
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
if(this.stakeholder?.alias !== this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder && this.stakeholder.type === 'funder') {
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("rfo/" + this.stakeholder.alias);
|
||||
let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("RF0", "relfunder", value, this.stakeholder.index_name, true)
|
||||
]);
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ import {CustomFilterService} from "../openaireLibrary/shared/customFilter.servic
|
|||
import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component";
|
||||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields";
|
||||
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
|
||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
|
||||
import {Irish} from "../shared/irish";
|
||||
|
||||
|
@ -101,23 +99,25 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
|
|||
this._customFilterService.setCustomFilter(null);
|
||||
this.alias = params['stakeholder'];
|
||||
if (this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder && this.stakeholder.type === 'organization') {
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("rpo/" + this.stakeholder.alias);
|
||||
let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("RPO", "relorganizationid", this.stakeholder.index_id, this.stakeholder.index_name, true)
|
||||
]);
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
if(this.stakeholder?.alias !== this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder && this.stakeholder.type === 'organization') {
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("rpo/" + this.stakeholder.alias);
|
||||
let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("RPO", "relorganizationid", this.stakeholder.index_id, this.stakeholder.index_name, true)
|
||||
]);
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue