Skip to content

Commit

Permalink
chore: when client is deleted respective identifier is deleted as well (
Browse files Browse the repository at this point in the history
#1941)

Refs: XRDDEV-2561
  • Loading branch information
enelir authored Jan 26, 2024
1 parent 9490033 commit c2ee1c1
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 99 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# X-Road: Security Server Configuration Data Model

Version: 1.9
Version: 1.10
Doc. ID: DM-SS

## Version history
Expand All @@ -20,6 +20,7 @@ Doc. ID: DM-SS
| 26.09.2022 | 1.7 | Remove Ubuntu 18.04 support | Andres Rosenthal |
| 10.05.2023 | 1.8 | Security Categories removed. | Justas Samuolis |
| 08.12.2023 | 1.9 | Added "Disabled" and related "in progress" client states | Madis Loitmaa |
| 26.01.2024 | 1.10 | When client is deleted, respective identifier is deleted as well | Eneli Reimets |

## Table of Contents
<!-- vim-markdown-toc GFM -->
Expand Down Expand Up @@ -299,7 +300,7 @@ Operations (insertions, updates and deletions of records) on the tables of this

### 2.10 IDENTIFIER

Identifier that can be used to identify various objects on X-Road. An identifier record is only created together with records of other entities and only one record of each identifier is ever created. For example, if a security server client record is created and its identifier is not found among identifier records, new one is created. The record is never modified or deleted.
Identifier that can be used to identify various objects on X-Road. An identifier record is only created together with records of other entities and only one record of each identifier is ever created. For example, if a security server client record is created and its identifier is not found among identifier records, new one is created. The record is never modified or deleted. An exception, when an entity of client is deleted, respective identifier is deleted as well.

#### 2.10.1 Attributes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public void saveOrUpdate(Collection<XRoadId.Conf> identifiers) {
}
}

public void remove(XRoadId.Conf identifier) {
persistenceUtils.getCurrentSession().remove(identifier);
}

/**
* return all identifiers
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,11 +825,15 @@ public void deleteLocalClient(ClientId clientId) throws ActionNotPossibleExcepti
if (!allowedStatuses.contains(clientType.getClientStatus())) {
throw new ActionNotPossibleException("cannot delete client with status " + clientType.getClientStatus());
}
removeLocalClient(clientType);
}

private void removeLocalClient(ClientType clientType) {
ServerConfType serverConfType = serverConfService.getServerConf();
if (!serverConfType.getClient().remove(clientType)) {
throw new RuntimeException("client to be deleted was somehow missing from serverconf");
throw new RuntimeException("client to be deleted was somehow missing from server conf");
}
identifierRepository.remove(clientType.getIdentifier());
}

/**
Expand Down
Loading

0 comments on commit c2ee1c1

Please sign in to comment.