mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Implemented live asset table in /Home/Index
This commit is contained in:
@@ -49,14 +49,20 @@ public partial class LdapService : IDisposable
|
||||
public string[] AssetsAttributes => ["CN", "description", "l", "owner", "serialNumber", "name"];
|
||||
public string[] LocationsAttributes => ["cn", "l", "street", "description"];
|
||||
public string[] GroupsAttributes => ["cn", "gidNumber", "description"];
|
||||
public async Task<IEnumerable<Dictionary<string, string>>> ListLocationsAsync()
|
||||
public async Task<IEnumerable<LocationModel>> ListLocationsAsync()
|
||||
{
|
||||
return await ListObjectBy(LocationsBaseDn, "", LocationsAttributes);
|
||||
IEnumerable<Dictionary<string, string>> locations = await ListObjectBy(LocationsBaseDn, "", LocationsAttributes);
|
||||
List<LocationModel> models = [];
|
||||
locations.ToList().ForEach(x => models.Add(new LocationModel(x) {Cn = x["cn"]}));
|
||||
return models;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Dictionary<string, string>>> ListUsersAsync()
|
||||
public async Task<IEnumerable<UserModel>> ListUsersAsync()
|
||||
{
|
||||
return await ListObjectBy(UsersBaseDn, "", UsersAttributes);
|
||||
IEnumerable<Dictionary<string, string>> users = await ListObjectBy(UsersBaseDn, "", UsersAttributes);
|
||||
List<UserModel> models = [];
|
||||
users.ToList().ForEach(x => models.Add(new UserModel(x) {Uid = x["uid"]}));
|
||||
return models;
|
||||
}
|
||||
|
||||
public async Task<MigrationModel> GetMigrationVersionAsync()
|
||||
@@ -158,9 +164,12 @@ public partial class LdapService : IDisposable
|
||||
return new AssetModel((await ListObjectBy(AssetsBaseDn, $"cn={cn}", attributes)).First()) { Cn = cn };
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Dictionary<string, string>>> ListDeviceAsync()
|
||||
public async Task<IEnumerable<AssetModel>> ListDeviceAsync()
|
||||
{
|
||||
return await ListObjectBy(AssetsBaseDn, "(objectClass=device)", AssetsAttributes);
|
||||
IEnumerable<Dictionary<string, string>> devices = await ListObjectBy(AssetsBaseDn, "(objectClass=device)", AssetsAttributes);
|
||||
List<AssetModel> models = [];
|
||||
devices.ToList().ForEach(x => models.Add(new AssetModel(x) {Cn = x["cn"]}));
|
||||
return models;
|
||||
}
|
||||
|
||||
public async Task CreateUser(string uid, LdapAttributeSet attributeSet)
|
||||
|
||||
Reference in New Issue
Block a user