mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 15:17:33 +00:00
cleanup
This commit is contained in:
@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { authGuard } from './guards/auth.guard';
|
||||
import { homeGuard } from './guards/home.guard';
|
||||
import { roleGuard } from './guards/role-guard';
|
||||
import { UserGrantContext } from './modules/user-grants/user-grants-datasource';
|
||||
import { OrgCreateComponent } from './pages/org-create/org-create.component';
|
||||
@@ -11,7 +10,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('./pages/home/home.module'),
|
||||
canActivate: [authGuard, homeGuard],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
roles: ['.'],
|
||||
},
|
||||
|
@@ -1,22 +0,0 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { GrpcAuthService } from '../services/grpc-auth.service';
|
||||
|
||||
export const homeGuard: CanActivateFn = (route) => {
|
||||
const authService = inject(GrpcAuthService);
|
||||
const router = inject(Router);
|
||||
|
||||
// Check if user has any roles (using the same logic as roleGuard)
|
||||
return authService.isAllowed(route.data['roles'], route.data['requiresAll']).pipe(
|
||||
map((hasRoles) => {
|
||||
if (!hasRoles) {
|
||||
// User has no roles, redirect to /users/me
|
||||
router.navigate(['/users/me']);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
);
|
||||
};
|
@@ -108,7 +108,6 @@ export class NewHeaderComponent {
|
||||
|
||||
private isOnInstanceLevel() {
|
||||
return computed(() => {
|
||||
console.log(this.breadcrumbs());
|
||||
return this.breadcrumbs().length === 1 && this.breadcrumbs()[0].type === BreadcrumbType.INSTANCE;
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user