[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,6 +134,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
|
|||
this._customFilterService.setCustomFilter(null);
|
||||
this.alias = params['stakeholder'];
|
||||
if (this.alias) {
|
||||
if(this.stakeholder?.alias !== this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
|
@ -156,6 +157,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
|
|||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
|
|||
this._customFilterService.setCustomFilter(null);
|
||||
this.alias = params['stakeholder'];
|
||||
if (this.alias) {
|
||||
if(this.stakeholder?.alias !== this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
|
@ -116,6 +117,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
|
|||
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,6 +99,7 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
|
|||
this._customFilterService.setCustomFilter(null);
|
||||
this.alias = params['stakeholder'];
|
||||
if (this.alias) {
|
||||
if(this.stakeholder?.alias !== this.alias) {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
|
@ -118,6 +117,7 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
|
|||
this.navigateToError();
|
||||
}
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue