Compare commits
4 Commits
f83b92ab63
...
601c051ecc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
601c051ecc | ||
|
|
94c77211fc | ||
|
|
b548aa796a | ||
|
|
0a0a327e58 |
@@ -37,7 +37,7 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Ok(new AuthCheckDto(IsAuthenticated: User.Identity?.IsAuthenticated ?? false));
|
return Ok(User.Identity?.IsAuthenticated ?? false);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,8 +117,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
if (dirEntryUsername is null)
|
if (dirEntryUsername is null)
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
|
|
||||||
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
|
return _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName).Then(Ok, IActionResult (m, n) =>
|
||||||
return Ok(result);
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -142,9 +145,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
if (filter is null)
|
if (filter is null)
|
||||||
return NotFound($"The filter named {filterName} does not exist.");
|
return NotFound($"The filter named {filterName} does not exist.");
|
||||||
|
|
||||||
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
|
return _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName).Then(Ok, IActionResult (m, n) =>
|
||||||
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -168,9 +173,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
if (filter is null)
|
if (filter is null)
|
||||||
throw new InvalidOperationException("The LDAP Group Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:Group to enable group searches.");
|
throw new InvalidOperationException("The LDAP Group Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:Group to enable group searches.");
|
||||||
|
|
||||||
var result = _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName);
|
return _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName).Then(Ok, IActionResult (m, n) =>
|
||||||
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -195,15 +202,21 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
if (filter is null)
|
if (filter is null)
|
||||||
throw new InvalidOperationException("The LDAP User Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:User to enable group searches.");
|
throw new InvalidOperationException("The LDAP User Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:User to enable group searches.");
|
||||||
|
|
||||||
var result = _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName);
|
return _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName).Then(
|
||||||
|
Success: data =>
|
||||||
if (groupName is not null && result.IsSuccess && result.Data is not null)
|
{
|
||||||
result.Data = result.Data
|
if (groupName is not null)
|
||||||
|
data = data
|
||||||
.Where(rp => rp.PropertyNames.Cast<string>().Contains("memberof") &&
|
.Where(rp => rp.PropertyNames.Cast<string>().Contains("memberof") &&
|
||||||
rp["memberof"].Cast<string>().Any(ldapDir => ldapDir.Contains(groupName)))
|
rp["memberof"].Cast<string>().Any(ldapDir => ldapDir.Contains(groupName)))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
return Ok(data);
|
||||||
return Ok(result);
|
},
|
||||||
|
Fail: IActionResult (m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.API;
|
using DigitalData.Core.API;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.Group;
|
using DigitalData.UserManager.Application.DTOs.Group;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
@@ -19,15 +20,19 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.CreateAsync(adGroup);
|
return await _service.CreateAsync(adGroup).ThenAsync(
|
||||||
if (result.IsSuccess)
|
Success: id =>
|
||||||
{
|
{
|
||||||
var createdResource = new { Id = result.Data };
|
var createdResource = new { Id = id };
|
||||||
var actionName = nameof(GetById);
|
var actionName = nameof(GetById);
|
||||||
var routeValues = new { id = createdResource.Id };
|
var routeValues = new { id = createdResource.Id };
|
||||||
return CreatedAtAction(actionName, routeValues, createdResource);
|
return CreatedAtAction(actionName, routeValues, createdResource);
|
||||||
}
|
},
|
||||||
return BadRequest(result);
|
Fail: IActionResult (m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return BadRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.API;
|
using DigitalData.Core.API;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
@@ -19,13 +20,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.DeleteAsyncByGroupUserId(groupId, userId);
|
return await _service.DeleteAsyncByGroupUserId(groupId, userId).ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
if (result.IsSuccess)
|
|
||||||
{
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
}
|
return BadRequest();
|
||||||
|
});
|
||||||
return BadRequest(result);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -42,13 +41,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.ReadAllAsyncWith(withUser, withGroup);
|
return await _service.ReadAllAsyncWith(withUser, withGroup).ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
if (result.IsSuccess)
|
|
||||||
{
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
}
|
return NotFound();
|
||||||
|
});
|
||||||
return NotFound(result);
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
@@ -62,7 +59,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Ok(await _service.HasGroup(username, groupname));
|
return await _service.HasGroup(username, groupname).ThenAsync(Ok, (m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.API;
|
using DigitalData.Core.API;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
@@ -19,13 +20,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.DeleteAsyncByModuleUserId(moduleId, userId);
|
return await _service.DeleteAsyncByModuleUserId(moduleId, userId).ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
if (result.IsSuccess)
|
|
||||||
{
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
}
|
return BadRequest();
|
||||||
|
});
|
||||||
return BadRequest(result);
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.API;
|
using DigitalData.Core.API;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
@@ -19,8 +20,12 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = assigned ? await _service.ReadByModuleIdAsync(moduleId) : await _service.ReadUnassignedByModuleIdAsync(moduleId);
|
return await (assigned ? _service.ReadByModuleIdAsync(moduleId) : _service.ReadUnassignedByModuleIdAsync(moduleId))
|
||||||
return Ok(result);
|
.ThenAsync(Ok, IActionResult(m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
@@ -34,8 +39,12 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = assigned ? await _service.ReadByGroupIdAsync(groupId) : await _service.ReadUnassignedByGroupIdAsync(groupId); ;
|
return await (assigned ? _service.ReadByGroupIdAsync(groupId) : _service.ReadUnassignedByGroupIdAsync(groupId))
|
||||||
return Ok(result);
|
.ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
@@ -49,15 +58,19 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.CreateAsync(upDto);
|
return await _service.CreateAsync(upDto).ThenAsync(
|
||||||
if (result.IsSuccess)
|
Success: id =>
|
||||||
{
|
{
|
||||||
var createdResource = new { Id = result.Data };
|
var createdResource = new { Id = id };
|
||||||
var actionName = nameof(GetById);
|
var actionName = nameof(GetById);
|
||||||
var routeValues = new { id = createdResource.Id };
|
var routeValues = new { id = createdResource.Id };
|
||||||
return CreatedAtAction(actionName, routeValues, createdResource);
|
return CreatedAtAction(actionName, routeValues, createdResource);
|
||||||
}
|
},
|
||||||
return BadRequest(result);
|
Fail: IActionResult (m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return BadRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
@@ -71,12 +84,11 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.ReadByUsernameAsync(username);
|
return await _service.ReadByUsernameAsync(username).ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
if (result.IsSuccess)
|
|
||||||
{
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
}
|
return NotFound();
|
||||||
return NotFound(result);
|
});
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.API;
|
using DigitalData.Core.API;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
@@ -26,14 +27,12 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
|
return await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId).ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
|
|
||||||
if (result.IsSuccess)
|
|
||||||
{
|
{
|
||||||
return Ok(result);
|
_logger.LogNotice(n);
|
||||||
}
|
return NotFound();
|
||||||
|
});
|
||||||
|
|
||||||
return NotFound(result);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { Observable, of } from 'rxjs';
|
|||||||
import { AuthenticationService } from '../services/authentication.service'; // Adjust the path as necessary
|
import { AuthenticationService } from '../services/authentication.service'; // Adjust the path as necessary
|
||||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { LoginComponent } from '../login/login.component';
|
import { LoginComponent } from '../login/login.component';
|
||||||
import Swal from 'sweetalert2';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';
|
||||||
import { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType } from '@generic-ui/ngx-grid';
|
import { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType } from '@generic-ui/ngx-grid';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
import { GroupService } from 'src/app/services/group.service';
|
import { GroupService } from '../../services/group.service';
|
||||||
import { forkJoin, of } from 'rxjs';
|
import { Observable, forkJoin, of } from 'rxjs';
|
||||||
import { catchError, finalize } from 'rxjs/operators';
|
import { catchError, finalize } from 'rxjs/operators';
|
||||||
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
|
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
|
||||||
|
import { DirGroupService } from '../../services/dir-group.service';
|
||||||
|
import { DirGroup } from '../../models/user-management.api.models';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-dir-import',
|
selector: 'app-group-dir-import',
|
||||||
@@ -40,15 +42,12 @@ export class GroupDirImportComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addSelectedGroups() {
|
addSelectedGroups() {
|
||||||
let requests = [];
|
let requests = new Array<Observable<DirGroup | null>>();
|
||||||
let numAdded: number = 0;
|
let numAdded: number = 0;
|
||||||
for (let row of this.dirGroups.selectedRows) {
|
for (let row of this.dirGroups.selectedRows) {
|
||||||
// Create an Observable for each request and add it to the requests array
|
|
||||||
requests.push(
|
requests.push(
|
||||||
this.gService.createByDir({ samaccountname: row?.source?.samaccountname }).pipe(
|
this.gService.createByDir({ samaccountname: row?.source?.samaccountname }).pipe(
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
console.log(err);
|
|
||||||
// In case of error, return a 'null' observable for this request, so it doesn't affect other requests
|
|
||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -72,13 +71,9 @@ export class GroupDirImportComponent implements OnInit, AfterViewInit {
|
|||||||
})
|
})
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: (results) => {
|
next: (results) => {
|
||||||
// Increment numAdded for each successful request
|
|
||||||
// You can increment numAdded for each result that is not null
|
|
||||||
numAdded += results.filter(result => result !== null).length;
|
numAdded += results.filter(result => result !== null).length;
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
// You may need to handle any potential errors here
|
|
||||||
console.log('An error occurred', err);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { AfterViewInit, Component, Inject, Input, OnDestroy, OnInit, ViewChild,
|
|||||||
import { ApiService } from '../../../services/user-management.api.service';
|
import { ApiService } from '../../../services/user-management.api.service';
|
||||||
import { GuiColumn, GuiColumnMenu, GuiSorting, GuiRowDetail, GuiPaging, GuiPagingDisplay, GuiSearching, GuiCellEdit, GuiInfoPanel, GuiTitlePanel, GuiRowSelection, GuiSelectedRow, GuiGridComponent, GuiGridApi, GuiTheme } from '@generic-ui/ngx-grid';
|
import { GuiColumn, GuiColumnMenu, GuiSorting, GuiRowDetail, GuiPaging, GuiPagingDisplay, GuiSearching, GuiCellEdit, GuiInfoPanel, GuiTitlePanel, GuiRowSelection, GuiSelectedRow, GuiGridComponent, GuiGridApi, GuiTheme } from '@generic-ui/ngx-grid';
|
||||||
import { Subscription } from 'rxjs/internal/Subscription';
|
import { Subscription } from 'rxjs/internal/Subscription';
|
||||||
import { ColorModeService, Theme } from 'src/app/services/color-mode.service';
|
import { ColorModeService, Theme } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-base-table',
|
selector: 'app-base-table',
|
||||||
@@ -151,16 +151,10 @@ export class BaseTableComponent<TModel, TApiService extends ApiService<TModel>>
|
|||||||
fetchData(): void {
|
fetchData(): void {
|
||||||
this.service.getAll().subscribe({
|
this.service.getAll().subscribe({
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
if (response.isSuccess && response.data) {
|
this.source = response;
|
||||||
this.source = response.data;
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} else {
|
|
||||||
// Handle response failure
|
|
||||||
console.error('Failed to fetch users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: (error) => console.error('Error fetching users:', error)
|
error: (error) => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { DirGroupService } from 'src/app/services/dir-group.service';
|
import { DirGroupService } from '../../../services/dir-group.service';
|
||||||
import { DirGroup } from 'src/app/models/user-management.api.models';
|
import { DirGroup } from '../../../models/user-management.api.models';
|
||||||
import { GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiColumn } from '@generic-ui/ngx-grid';
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dir-group-table',
|
selector: 'app-dir-group-table',
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { DirUser } from 'src/app/models/user-management.api.models';
|
import { DirUser } from '../../../models/user-management.api.models';
|
||||||
import { DirUserService } from 'src/app/services/dir-user.service';
|
import { DirUserService } from '../../../services/dir-user.service';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { GuiColumn } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
|
import { GuiColumn } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dir-user-table',
|
selector: 'app-dir-user-table',
|
||||||
@@ -17,17 +17,11 @@ export class DirUserTableComponent extends BaseTableComponent<DirUser, DirUserSe
|
|||||||
|
|
||||||
fetchDataByGroupName(groupName: string): void {
|
fetchDataByGroupName(groupName: string): void {
|
||||||
this.service.getAll(groupName).subscribe({
|
this.service.getAll(groupName).subscribe({
|
||||||
next: (response) => {
|
next: (response: any) => {
|
||||||
if (response.isSuccess && response.data) {
|
this.source = response;
|
||||||
this.source = response.data;
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} else {
|
|
||||||
// Handle response failure
|
|
||||||
this.loading = false;
|
|
||||||
console.error('Failed to fetch users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: (error) => console.error('Error fetching users:', error)
|
error: (error: any) => {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ import { GroupService } from '../../../services/group.service';
|
|||||||
import { Group } from '../../../models/user-management.api.models';
|
import { Group } from '../../../models/user-management.api.models';
|
||||||
import { GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiColumn } from '@generic-ui/ngx-grid';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-table',
|
selector: 'app-group-table',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { GroupOfUserService } from '../../../services/group-of-user.service';
|
|||||||
import { GroupOfUser } from '../../../models/user-management.api.models';
|
import { GroupOfUser } from '../../../models/user-management.api.models';
|
||||||
import { GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiColumn } from '@generic-ui/ngx-grid';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-user-table',
|
selector: 'app-group-user-table',
|
||||||
@@ -20,14 +20,9 @@ export class GroupUserTableComponent extends BaseTableComponent<GroupOfUser, Gro
|
|||||||
fetchDataWith(withUser: boolean, withGroup: boolean){
|
fetchDataWith(withUser: boolean, withGroup: boolean){
|
||||||
this.service.getAll(withUser, withGroup).subscribe ({
|
this.service.getAll(withUser, withGroup).subscribe ({
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
if (response.isSuccess && response.data) {
|
this.source = response;
|
||||||
this.source = response.data;
|
|
||||||
} else {
|
|
||||||
// Handle response failure
|
|
||||||
console.error('Failed to fetch users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: (error) => console.error('Error fetching users:', error)
|
error: (error) => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ import { Module } from '../../../models/user-management.api.models';
|
|||||||
import { GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiColumn } from '@generic-ui/ngx-grid';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { ModuleService } from '../../../services/module.service'
|
import { ModuleService } from '../../../services/module.service'
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-module-table',
|
selector: 'app-module-table',
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { UserRep } from 'src/app/models/user-management.api.models';
|
import { UserRep } from '../../../models/user-management.api.models';
|
||||||
import { UserRepService } from 'src/app/services/user-representation.service';
|
import { UserRepService } from '../../../services/user-representation.service';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiColumn } from '@generic-ui/ngx-grid';
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-rep-table',
|
selector: 'app-user-rep-table',
|
||||||
@@ -19,16 +19,11 @@ export class UserRepTableComponent extends BaseTableComponent<UserRep, UserRepSe
|
|||||||
|
|
||||||
override fetchData(userId?: number): void {
|
override fetchData(userId?: number): void {
|
||||||
this.service.getAll(false, true, true, true, userId).subscribe({
|
this.service.getAll(false, true, true, true, userId).subscribe({
|
||||||
next: (response) => {
|
next: (response: UserRep[]) => {
|
||||||
if (response.isSuccess && response.data) {
|
this.source = response;
|
||||||
this.source = response.data;
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} else {
|
|
||||||
// Handle response failure
|
|
||||||
console.error('Failed to fetch users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: (error) => console.error('Error fetching users:', error)
|
error: (error: any) => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import { GroupOfUserService } from '../../../services/group-of-user.service';
|
|||||||
import { User } from '../../../models/user-management.api.models';
|
import { User } from '../../../models/user-management.api.models';
|
||||||
import { GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiColumn } from '@generic-ui/ngx-grid';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { ColorModeService } from 'src/app/services/color-mode.service';
|
import { ColorModeService } from '../../../services/color-mode.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-table',
|
selector: 'app-user-table',
|
||||||
@@ -17,7 +17,11 @@ export class UserTableComponent extends BaseTableComponent<User, UserService> {
|
|||||||
mosService: ModuleOfUserService;
|
mosService: ModuleOfUserService;
|
||||||
gosService: GroupOfUserService;
|
gosService: GroupOfUserService;
|
||||||
|
|
||||||
constructor(mosService: ModuleOfUserService, gosService: GroupOfUserService, service: UserService, @Inject('USER_TABLE_COLUMNS') columns: Array<GuiColumn>, cModeService: ColorModeService) {
|
constructor(mosService: ModuleOfUserService,
|
||||||
|
gosService: GroupOfUserService,
|
||||||
|
service: UserService,
|
||||||
|
@Inject('USER_TABLE_COLUMNS') columns: Array<GuiColumn>,
|
||||||
|
cModeService: ColorModeService) {
|
||||||
super(service, columns, cModeService)
|
super(service, columns, cModeService)
|
||||||
this.mosService = mosService;
|
this.mosService = mosService;
|
||||||
this.gosService = gosService;
|
this.gosService = gosService;
|
||||||
@@ -25,30 +29,19 @@ export class UserTableComponent extends BaseTableComponent<User, UserService> {
|
|||||||
|
|
||||||
fetchDataByModuleId(moduleId: number, assigned: boolean = true): void {
|
fetchDataByModuleId(moduleId: number, assigned: boolean = true): void {
|
||||||
this.service.getByModuleId(moduleId, assigned).subscribe({
|
this.service.getByModuleId(moduleId, assigned).subscribe({
|
||||||
next: (response) => {
|
next: (users) => {
|
||||||
|
this.source = users;
|
||||||
if (response.isSuccess && response.data) {
|
|
||||||
this.source = response.data;
|
|
||||||
} else {
|
|
||||||
// Handle response failure
|
|
||||||
console.error('Failed to fetch users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: (error) => console.error('Error fetching users:', error)
|
error: (error) => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchDataByGroupId(groupId: number, assigned: boolean = true): void {
|
fetchDataByGroupId(groupId: number, assigned: boolean = true): void {
|
||||||
this.service.getByGroupId(groupId, assigned).subscribe({
|
this.service.getByGroupId(groupId, assigned).subscribe({
|
||||||
next: (response) => {
|
next: (users) => {
|
||||||
if (response.isSuccess && response.data) {
|
this.source = users;
|
||||||
this.source = response.data;
|
|
||||||
} else {
|
|
||||||
// Handle response failure
|
|
||||||
console.error('Failed to fetch users');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: (error) => console.error('Error fetching users:', error)
|
error: (error) => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,13 +68,7 @@ export class UserTableComponent extends BaseTableComponent<User, UserService> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const responses = await Promise.all(deletionPromises);
|
const responses = await Promise.all(deletionPromises);
|
||||||
responses.forEach(response => {
|
|
||||||
if (!response?.isSuccess) {
|
|
||||||
console.error(response?.messages);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting module of users:', error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,13 +79,7 @@ export class UserTableComponent extends BaseTableComponent<User, UserService> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const responses = await Promise.all(deletionPromises);
|
const responses = await Promise.all(deletionPromises);
|
||||||
responses.forEach(response => {
|
|
||||||
if (!response?.isSuccess) {
|
|
||||||
console.error(response?.messages);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting group of users:', error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';
|
||||||
import { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType, GuiSelectedRow } from '@generic-ui/ngx-grid';
|
import { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType, GuiSelectedRow } from '@generic-ui/ngx-grid';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
import { GroupService } from 'src/app/services/group.service';
|
import { GroupService } from '../../services/group.service';
|
||||||
import { forkJoin, of } from 'rxjs';
|
import { Observable, forkJoin, of } from 'rxjs';
|
||||||
import { catchError, finalize } from 'rxjs/operators';
|
import { catchError, finalize } from 'rxjs/operators';
|
||||||
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
|
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
|
||||||
import { DirUserTableComponent } from '../tables/dir-user-table/dir-user-table.component';
|
import { DirUserTableComponent } from '../tables/dir-user-table/dir-user-table.component';
|
||||||
import { UserService } from 'src/app/services/user.service';
|
import { UserService } from '../../services/user.service';
|
||||||
|
import {User} from '../../models/user-management.api.models'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-group-dir-import',
|
selector: 'app-user-group-dir-import',
|
||||||
@@ -43,10 +44,9 @@ export class UserGroupDirImportComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addSelectedUsers() {
|
addSelectedUsers() {
|
||||||
let requests = [];
|
let requests = new Array<Observable<User | null>>();
|
||||||
let numAdded: number = 0;
|
let numAdded: number = 0;
|
||||||
for (let row of this.dirUsers.selectedRows) {
|
for (let row of this.dirUsers.selectedRows) {
|
||||||
console.log(row)
|
|
||||||
// Create an Observable for each request and add it to the requests array
|
// Create an Observable for each request and add it to the requests array
|
||||||
requests.push(
|
requests.push(
|
||||||
this.uService.create({
|
this.uService.create({
|
||||||
@@ -56,8 +56,6 @@ export class UserGroupDirImportComponent implements OnInit, AfterViewInit {
|
|||||||
name: row.source?.sn?.[0],
|
name: row.source?.sn?.[0],
|
||||||
}).pipe(
|
}).pipe(
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
console.log('An error occurred', err);
|
|
||||||
// In case of error, return a 'null' observable for this request, so it doesn't affect other requests
|
|
||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -81,13 +79,9 @@ export class UserGroupDirImportComponent implements OnInit, AfterViewInit {
|
|||||||
})
|
})
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: (results) => {
|
next: (results) => {
|
||||||
// Increment numAdded for each successful request
|
|
||||||
// You can increment numAdded for each result that is not null
|
|
||||||
numAdded += results.filter(result => result !== null).length;
|
numAdded += results.filter(result => result !== null).length;
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
// You may need to handle any potential errors here
|
|
||||||
console.log('An error occurred', err);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { GuiColumn, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/cor
|
|||||||
import { UserTableComponent } from '../tables/user-table/user-table.component';
|
import { UserTableComponent } from '../tables/user-table/user-table.component';
|
||||||
import { UserRepTableComponent } from '../tables/user-rep-table/user-rep-table.component';
|
import { UserRepTableComponent } from '../tables/user-rep-table/user-rep-table.component';
|
||||||
import { GroupTableComponent } from '../tables/group-table/group-table.component';
|
import { GroupTableComponent } from '../tables/group-table/group-table.component';
|
||||||
import { UserRepService } from 'src/app/services/user-representation.service';
|
import { UserRepService } from '../../services/user-representation.service';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
@@ -12,12 +12,9 @@ export class UserComponent {
|
|||||||
cellEditing: GuiCellEdit = {
|
cellEditing: GuiCellEdit = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
rowEdit: (value: any, item: any, index: number) => {
|
rowEdit: (value: any, item: any, index: number) => {
|
||||||
console.log("rowEdit", value, item, index)
|
|
||||||
console.log(this.userTable.selectedRows)
|
|
||||||
return Boolean(index % 2);
|
return Boolean(index % 2);
|
||||||
},
|
},
|
||||||
cellEdit: (value: any, item: any, index: number) => {
|
cellEdit: (value: any, item: any, index: number) => {
|
||||||
console.log("cellEdit", value, item, index)
|
|
||||||
return Boolean(index % 5);
|
return Boolean(index % 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
export interface ApiMessage {
|
|
||||||
isSuccess: boolean;
|
|
||||||
messages: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ApiResult<T> extends ApiMessage {
|
|
||||||
data?: T;
|
|
||||||
}
|
|
||||||
@@ -77,7 +77,3 @@ export interface DirUser {
|
|||||||
mail?: string;
|
mail?: string;
|
||||||
addedWho?: string;
|
addedWho?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthCheckDto {
|
|
||||||
isAuthenticated: boolean;
|
|
||||||
}
|
|
||||||
@@ -60,7 +60,6 @@ export class NavMenuComponent {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.error("unexpected err happend", err)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Inject, Injectable } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ApiMessage, ApiResult } from '../models/api.response.model';
|
|
||||||
import { AuthCheckDto } from '../models/user-management.api.models';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@@ -10,15 +8,20 @@ import Swal from 'sweetalert2';
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class AuthenticationService {
|
export class AuthenticationService {
|
||||||
constructor(private router: Router, private http: HttpClient, @Inject('LOGIN_URL') private loginUrl: string, @Inject('LOGOUT_URL') private logoutUrl: string, @Inject('LOGIN_CHECK_URL') private checkUrl: string) { }
|
constructor(
|
||||||
|
private router: Router,
|
||||||
|
private http: HttpClient,
|
||||||
|
@Inject('LOGIN_URL') private loginUrl: string,
|
||||||
|
@Inject('LOGOUT_URL') private logoutUrl: string,
|
||||||
|
@Inject('LOGIN_CHECK_URL') private checkUrl: string) { }
|
||||||
|
|
||||||
isAuthenticated(): Observable<boolean> {
|
isAuthenticated(): Observable<boolean> {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
this.http.get<AuthCheckDto>(this.checkUrl, { withCredentials: true })
|
this.http.get<boolean>(this.checkUrl, { withCredentials: true })
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
_isLogedIn = response.isAuthenticated;
|
_isLogedIn = response;
|
||||||
observer.next(response.isAuthenticated)
|
observer.next(response)
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
this.showErrorAlert()
|
this.showErrorAlert()
|
||||||
@@ -50,9 +53,9 @@ export class AuthenticationService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
logout(): Observable<ApiMessage> {
|
logout(): Observable<any> {
|
||||||
return new Observable(observer => {
|
return new Observable(observer => {
|
||||||
this.http.post<ApiMessage>(this.logoutUrl, {}, { withCredentials: true })
|
this.http.post<any>(this.logoutUrl, {}, { withCredentials: true })
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { Injectable, Inject } from '@angular/core';
|
import { Injectable, Inject } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { DirGroup, DirUser } from '../models/user-management.api.models';
|
import { DirGroup, } from '../models/user-management.api.models';
|
||||||
import { ApiService } from './user-management.api.service';
|
import { ApiService } from './user-management.api.service';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@@ -14,21 +13,20 @@ export class DirGroupService extends ApiService<DirGroup> {
|
|||||||
super(http, userUri);
|
super(http, userUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
override getAll(): Observable<ApiResult<DirGroup[]>> {
|
//TODO: Swal.fire
|
||||||
return new Observable(observer => {
|
override getAll(): Observable<DirGroup[]> {
|
||||||
|
return new Observable<DirGroup[]>(observer => {
|
||||||
super.getAll()
|
super.getAll()
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
if(!response.isSuccess || !response.data) {
|
observer.next(response)
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: "error",
|
icon: "error",
|
||||||
title: "Oops...",
|
title: "Oops...",
|
||||||
text: `Active Directory-Verbindung verloren. Bitte melden Sie sich erneut an`,
|
text: `Active Directory-Verbindung verloren. Bitte melden Sie sich erneut an`,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
observer.next(response)
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
observer.error(error)
|
observer.error(error)
|
||||||
},
|
},
|
||||||
complete: () => observer.complete()
|
complete: () => observer.complete()
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|||||||
import { DirUser } from '../models/user-management.api.models';
|
import { DirUser } from '../models/user-management.api.models';
|
||||||
import { ApiService } from './user-management.api.service';
|
import { ApiService } from './user-management.api.service';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -13,12 +12,12 @@ export class DirUserService extends ApiService<DirUser> {
|
|||||||
super(http, userUri);
|
super(http, userUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
override getAll(groupName?: string): Observable<ApiResult<DirUser[]>> {
|
override getAll(groupName?: string): Observable<DirUser[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
if (groupName) {
|
if (groupName) {
|
||||||
params = params.set('groupName', groupName);
|
params = params.set('groupName', groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get<ApiResult<DirUser[]>>(this.baseUrl, { params, withCredentials: true });
|
return this.http.get<DirUser[]>(this.baseUrl, { params, withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
import { Inject, Injectable } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
import { DirUser } from '../models/user-management.api.models';
|
import { DirUser } from '../models/user-management.api.models';
|
||||||
|
|
||||||
@@ -12,12 +11,12 @@ export class DirService {
|
|||||||
this.http = http;
|
this.http = http;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUser(groupName: string): Observable<ApiResult<DirUser[]>> {
|
getUser(groupName: string): Observable<DirUser[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
if (groupName) {
|
if (groupName) {
|
||||||
params = params.set('groupName', groupName);
|
params = params.set('groupName', groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get<ApiResult<DirUser[]>>(this.baseUrl, { params, withCredentials: true });
|
return this.http.get<DirUser[]>(this.baseUrl, { params, withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ import { Injectable, Inject } from '@angular/core';
|
|||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { GroupOfUser } from '../models/user-management.api.models';
|
import { GroupOfUser } from '../models/user-management.api.models';
|
||||||
import { ApiService } from './user-management.api.service';
|
import { ApiService } from './user-management.api.service';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -13,12 +12,12 @@ export class GroupOfUserService extends ApiService<GroupOfUser> {
|
|||||||
super(http, userUri);
|
super(http, userUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteByGroupUserId(groupId: number, userId: number): Observable<ApiResult<any>> {
|
deleteByGroupUserId(groupId: number, userId: number): Observable<any> {
|
||||||
const url = `${this.baseUrl}?groupId=${groupId}&userId=${userId}`;
|
const url = `${this.baseUrl}?groupId=${groupId}&userId=${userId}`;
|
||||||
return this.http.delete<ApiResult<any>>(url, { withCredentials: true });
|
return this.http.delete<any>(url, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
override getAll(withUser: boolean = false, withGroup: boolean = false): Observable<ApiResult<GroupOfUser[]>> {
|
override getAll(withUser: boolean = false, withGroup: boolean = false): Observable<GroupOfUser[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
if (withUser) {
|
if (withUser) {
|
||||||
params = params.set('withUser', withUser);
|
params = params.set('withUser', withUser);
|
||||||
@@ -27,6 +26,6 @@ export class GroupOfUserService extends ApiService<GroupOfUser> {
|
|||||||
params = params.set('withGroup', withGroup);
|
params = params.set('withGroup', withGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get<ApiResult<GroupOfUser[]>>(this.baseUrl, { params, withCredentials: true });
|
return this.http.get<GroupOfUser[]>(this.baseUrl, { params, withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ import { Injectable, Inject } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { ModuleOfUser } from '../models/user-management.api.models';
|
import { ModuleOfUser } from '../models/user-management.api.models';
|
||||||
import { ApiService } from './user-management.api.service';
|
import { ApiService } from './user-management.api.service';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -13,8 +12,8 @@ export class ModuleOfUserService extends ApiService<ModuleOfUser> {
|
|||||||
super(http, userUri);
|
super(http, userUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteByModuleGroupId(moduleId: number, userId: number): Observable<ApiResult<any>> {
|
deleteByModuleGroupId(moduleId: number, userId: number): Observable<any> {
|
||||||
const url = `${this.baseUrl}?moduleId=${moduleId}&userId=${userId}`;
|
const url = `${this.baseUrl}?moduleId=${moduleId}&userId=${userId}`;
|
||||||
return this.http.delete<ApiResult<any>>(url, { withCredentials: true });
|
return this.http.delete<any>(url, { withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
import { Inject, Injectable } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -15,26 +14,26 @@ export class ApiService<Model> {
|
|||||||
http: HttpClient;
|
http: HttpClient;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
|
|
||||||
getAll(): Observable<ApiResult<Model[]>> {
|
getAll(): Observable<Model[]> {
|
||||||
return this.http.get<ApiResult<Model[]>>(this.baseUrl, { withCredentials: true });
|
return this.http.get<Model[]>(this.baseUrl, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
getById(id: number): Observable<ApiResult<Model>> {
|
getById(id: number): Observable<Model> {
|
||||||
const url = `${this.baseUrl}/${id}`;
|
const url = `${this.baseUrl}/${id}`;
|
||||||
return this.http.get<ApiResult<Model>>(url, { withCredentials: true });
|
return this.http.get<Model>(url, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
create(createModel: Model): Observable<Model> {
|
create(createModel: Model): Observable<Model> {
|
||||||
return this.http.post<Model>(this.baseUrl, createModel, { withCredentials: true });
|
return this.http.post<Model>(this.baseUrl, createModel, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
update(updateModel: Model): Observable<ApiResult<Model>> {
|
update(updateModel: Model): Observable<Model> {
|
||||||
const url = `${this.baseUrl}`;
|
const url = `${this.baseUrl}`;
|
||||||
return this.http.put<ApiResult<Model>>(url, updateModel, { withCredentials: true });
|
return this.http.put<Model>(url, updateModel, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(id: number): Observable<ApiResult<any>> {
|
delete(id: number): Observable<any> {
|
||||||
const url = `${this.baseUrl}/${id}`;
|
const url = `${this.baseUrl}/${id}`;
|
||||||
return this.http.delete<ApiResult<any>>(url, { withCredentials: true });
|
return this.http.delete<any>(url, { withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ import { Inject, Injectable } from "@angular/core";
|
|||||||
import { UserRep } from "../models/user-management.api.models";
|
import { UserRep } from "../models/user-management.api.models";
|
||||||
import { ApiService } from "./user-management.api.service";
|
import { ApiService } from "./user-management.api.service";
|
||||||
import { HttpClient, HttpParams } from "@angular/common/http";
|
import { HttpClient, HttpParams } from "@angular/common/http";
|
||||||
import { ApiResult } from "../models/api.response.model";
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -13,7 +12,7 @@ export class UserRepService extends ApiService<UserRep> {
|
|||||||
super(http, userRepUri)
|
super(http, userRepUri)
|
||||||
}
|
}
|
||||||
|
|
||||||
override getAll(withUser: boolean = false, withRepGroup: boolean = false, withRightGroup: boolean = false, withRepUser: boolean = false, userId?: number): Observable<ApiResult<UserRep[]>> {
|
override getAll(withUser: boolean = false, withRepGroup: boolean = false, withRightGroup: boolean = false, withRepUser: boolean = false, userId?: number): Observable<UserRep[]> {
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
if (withUser) {
|
if (withUser) {
|
||||||
params = params.set('withUser', withUser);
|
params = params.set('withUser', withUser);
|
||||||
@@ -31,6 +30,6 @@ export class UserRepService extends ApiService<UserRep> {
|
|||||||
params = params.set('userId', userId)
|
params = params.set('userId', userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get<ApiResult<UserRep[]>>(`${this.baseUrl}`, { params: params, withCredentials: true });
|
return this.http.get<UserRep[]>(`${this.baseUrl}`, { params: params, withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
import { DirUser, User } from '../models/user-management.api.models';
|
import { DirUser, User } from '../models/user-management.api.models';
|
||||||
import { ApiService } from './user-management.api.service';
|
import { ApiService } from './user-management.api.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ApiResult } from '../models/api.response.model';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -13,18 +12,17 @@ export class UserService extends ApiService<User> {
|
|||||||
super(http, userUri);
|
super(http, userUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
getByModuleId(moduleId: number, assigned: boolean = true): Observable<ApiResult<User[]>> {
|
getByModuleId(moduleId: number, assigned: boolean = true): Observable<User[]> {
|
||||||
const url = `${this.baseUrl}/ByModuleId/${moduleId}?assigned=${assigned}`;
|
const url = `${this.baseUrl}/ByModuleId/${moduleId}?assigned=${assigned}`;
|
||||||
return this.http.get<ApiResult<User[]>>(url, { withCredentials: true });
|
return this.http.get<User[]>(url, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
getByGroupId(groupId: number, assigned: boolean = true): Observable<ApiResult<User[]>> {
|
getByGroupId(groupId: number, assigned: boolean = true): Observable<User[]> {
|
||||||
const url = `${this.baseUrl}/ByGroupId/${groupId}?assigned=${assigned}`;
|
const url = `${this.baseUrl}/ByGroupId/${groupId}?assigned=${assigned}`;
|
||||||
return this.http.get<ApiResult<User[]>>(url, { withCredentials: true });
|
return this.http.get<User[]>(url, { withCredentials: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
createByDir(createModel: DirUser): Observable<DirUser> {
|
createByDir(createModel: DirUser): Observable<DirUser> {
|
||||||
console.log(createModel)
|
|
||||||
return this.http.post<DirUser>(`${this.baseUrl}/byDir`, createModel, { withCredentials: true });
|
return this.http.post<DirUser>(`${this.baseUrl}/byDir`, createModel, { withCredentials: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,4 +184,4 @@ if (environment.production) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
platformBrowserDynamic(providers).bootstrapModule(AppModule)
|
platformBrowserDynamic(providers).bootstrapModule(AppModule)
|
||||||
.catch(err => console.log(err));
|
.catch(err => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user