mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Merge pull request #175 from LD-Reborn/174-bug-updating-asset-to-empty-location-has-no-effect
Fixed updating asset to empty location only clientside
This commit is contained in:
@@ -173,6 +173,10 @@ public class AssetsController : Controller
|
|||||||
{
|
{
|
||||||
await _ldap.UpdateAsset(cn, "l", requestModel.Location);
|
await _ldap.UpdateAsset(cn, "l", requestModel.Location);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _ldap.DeleteAttribute(_ldap.AssetsBaseDn, "cn", cn, "l");
|
||||||
|
}
|
||||||
if (requestModel.Name is not null)
|
if (requestModel.Name is not null)
|
||||||
{
|
{
|
||||||
await _ldap.UpdateAsset(cn, "name", requestModel.Name);
|
await _ldap.UpdateAsset(cn, "name", requestModel.Name);
|
||||||
|
|||||||
@@ -429,6 +429,19 @@ public async Task CreateAsset(LdapAttributeSet attributeSet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task DeleteAttribute(string baseDn, string rdnKey, string rdnValue, string attributeName)
|
||||||
|
{
|
||||||
|
await ConnectAndBind();
|
||||||
|
string dn = PrependRDN($"{rdnKey}={rdnValue}", baseDn);
|
||||||
|
|
||||||
|
var modification = new LdapModification(
|
||||||
|
LdapModification.Delete,
|
||||||
|
new LdapAttribute(attributeName)
|
||||||
|
);
|
||||||
|
|
||||||
|
await _conn.ModifyAsync(dn, modification);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task DeleteObjectByDnAsync(string dn)
|
public async Task DeleteObjectByDnAsync(string dn)
|
||||||
{
|
{
|
||||||
await _conn.DeleteAsync(dn);
|
await _conn.DeleteAsync(dn);
|
||||||
|
|||||||
Reference in New Issue
Block a user