mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added Locations Delete CRUD element
This commit is contained in:
@@ -16,4 +16,22 @@ public class LocationsController : Controller
|
||||
return list;
|
||||
}
|
||||
|
||||
[HttpGet("Delete")]
|
||||
public async Task<bool> Delete(string cn)
|
||||
{
|
||||
if (cn is null) { return false; }
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_ldap.DeleteLocation(cn);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -261,6 +261,12 @@ public partial class LdapService : IDisposable
|
||||
DeleteObjectByDn(dn);
|
||||
}
|
||||
|
||||
public void DeleteLocation(string cn)
|
||||
{
|
||||
string dn = PrependRDN($"cn={cn}", LocationsBaseDn);
|
||||
DeleteObjectByDn(dn);
|
||||
}
|
||||
|
||||
public async Task UpdateUser(string uid, string attributeName, string attributeValue)
|
||||
{
|
||||
await UpdateObject(UsersBaseDn, "uid", uid, attributeName, attributeValue);
|
||||
|
||||
Reference in New Issue
Block a user