subGroupIds) implements Serializable {
+
+ public static GroupDto fromGroup(Group group, Locale locale) {
+ return new GroupDto(group.getStringId(), group.getDisplayName(), group.getIdentifier(), group.getOwnerUsername(),
+ group.getAuthoritySet().stream().map(AuthorityDto::fromAuthority).collect(Collectors.toSet()),
+ group.getProcessRoles().stream().map(processRole -> new ProcessRoleDto(processRole, locale)).collect(Collectors.toSet()),
+ group.getGroupIds() == null ? new HashSet<>() : new HashSet<>(group.getGroupIds()),
+ group.getSubgroupIds() == null ? new HashSet<>() : new HashSet<>(group.getSubgroupIds())
+ );
+ }
+
+}
diff --git a/nae-object-library/src/main/java/com/netgrif/application/engine/objects/dto/response/petrinet/ProcessRoleDto.java b/nae-object-library/src/main/java/com/netgrif/application/engine/objects/dto/response/petrinet/ProcessRoleDto.java
new file mode 100644
index 00000000000..5c820c76913
--- /dev/null
+++ b/nae-object-library/src/main/java/com/netgrif/application/engine/objects/dto/response/petrinet/ProcessRoleDto.java
@@ -0,0 +1,28 @@
+package com.netgrif.application.engine.objects.dto.response.petrinet;
+
+import com.netgrif.application.engine.objects.petrinet.domain.roles.ProcessRole;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public record ProcessRoleDto(String stringId, String name, String description, String importId, String netImportId,
+ String netVersion, String netStringId, boolean global) implements Serializable {
+
+ /**
+ * This constructor doesn't set attributes regarding the Petri net.
+ *
+ * Use the ProcessRoleFactory to create instances that have these attributes set.
+ */
+ public ProcessRoleDto(ProcessRole role, Locale locale) {
+ this(role.getStringId(), role.getLocalisedName(locale), role.getDescription(), role.getImportId(), null, null, null, role.isGlobal());
+ }
+
+ public ProcessRoleDto(ProcessRole role, Locale locale, String netImportId,
+ String netVersion, String netStringId) {
+ this(role.getStringId(), role.getLocalisedName(locale), role.getDescription(), role.getImportId(),netImportId, netVersion, netStringId, role.isGlobal());
+ }
+
+ public ProcessRoleDto(String id, String name, String description, boolean global) {
+ this(id, name, description, null, null, null, null, global);
+ }
+}
diff --git a/nae-object-library/src/test/java/com/netgrif/application/engine/objects/auth/domain/AbstractActorTest.java b/nae-object-library/src/test/java/com/netgrif/application/engine/objects/auth/domain/AbstractActorTest.java
new file mode 100644
index 00000000000..c8b82e91b1b
--- /dev/null
+++ b/nae-object-library/src/test/java/com/netgrif/application/engine/objects/auth/domain/AbstractActorTest.java
@@ -0,0 +1,423 @@
+package com.netgrif.application.engine.objects.auth.domain;
+
+import com.netgrif.application.engine.objects.petrinet.domain.roles.ProcessRole;
+import org.bson.types.ObjectId;
+import org.junit.jupiter.api.Test;
+
+import java.util.*;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class AbstractActorTest {
+
+ static class TestActor extends AbstractActor {
+ public TestActor() {
+ super();
+ }
+
+ public TestActor(ObjectId id, String realmId) {
+ super(id, realmId);
+ }
+
+ public TestActor(String stringId, String realmId) {
+ super(stringId, realmId);
+ }
+
+ public TestActor(ObjectId id, String realmId, Map> attributes,
+ Set authorityIds, Set authoritySet,
+ Set processRoleIds, Set processRoles,
+ Set groupIds) {
+ super(id, realmId, attributes, authorityIds, authoritySet, processRoleIds, processRoles, groupIds);
+ }
+
+ @Override
+ String getName() {
+ return "test-actor";
+ }
+
+ @Override
+ String getFullName() {
+ return "Test Actor FullName";
+ }
+ }
+
+ static class TestAuthority extends Authority {
+ private final ObjectId id;
+
+ public TestAuthority(String name) {
+ super(name);
+ this.id = new ObjectId();
+ }
+
+ public TestAuthority(String id, String name) {
+ super(name);
+ this.id = new ObjectId(id);
+ }
+
+ @Override
+ public ObjectId get_id() {
+ return id;
+ }
+
+ @Override
+ public String getStringId() {
+ return id.toString();
+ }
+ }
+
+ static class TestProcessRole extends ProcessRole {
+ public TestProcessRole(String id) {
+ super(id);
+ }
+ }
+
+ @Test
+ void testConstructorsAndIdManagement() {
+ TestActor actorDefault = new TestActor();
+ assertNull(actorDefault.getId());
+ assertNull(actorDefault.getRealmId());
+ assertEquals("test-actor", actorDefault.getName());
+ assertEquals("Test Actor FullName", actorDefault.getFullName());
+
+ ObjectId objectId = new ObjectId();
+ TestActor actorWithObjId = new TestActor(objectId, "realm-1");
+ assertEquals(objectId, actorWithObjId.getId());
+ assertEquals(objectId.toString(), actorWithObjId.getStringId());
+ assertEquals("realm-1", actorWithObjId.getRealmId());
+
+ String stringId = new ObjectId().toString();
+ TestActor actorWithStringId = new TestActor(stringId, "realm-2");
+ assertEquals(stringId, actorWithStringId.getId().toString());
+ assertEquals("realm-2", actorWithStringId.getRealmId());
+
+ ObjectId newId = new ObjectId();
+ actorDefault.setId(newId);
+ assertEquals(newId, actorDefault.getId());
+
+ String newIdStr = new ObjectId().toString();
+ actorDefault.setId(newIdStr);
+ assertEquals(newIdStr, actorDefault.getId().toString());
+
+ actorDefault.setRealmId("realm-updated");
+ assertEquals("realm-updated", actorDefault.getRealmId());
+ }
+
+ @Test
+ void testAllArgsConstructor() {
+ ObjectId id = new ObjectId();
+ Map> attrs = new HashMap<>();
+ attrs.put("key1", new Attribute<>("val1", false));
+ Set authIds = Set.of(new ObjectId().toString());
+ Set