diff --git a/CDP4Common/CDP4Common.csproj b/CDP4Common/CDP4Common.csproj
index 3230a363..6a9d5be4 100644
--- a/CDP4Common/CDP4Common.csproj
+++ b/CDP4Common/CDP4Common.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4Common Community Edition
- 27.1.0
+ 27.2.0
CDP4 Common Class Library that contains DTOs, POCOs
Copyright © Starion Group S.A.
Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathanael, Ahmed
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [ADD] Implement ExceptionHandlerService
+ [FIX] PermissionService
README.md
diff --git a/CDP4Dal.NetCore.Tests/Permission/PermissionServiceTestFixture.cs b/CDP4Dal.NetCore.Tests/Permission/PermissionServiceTestFixture.cs
index edb4c2ec..99a7c120 100644
--- a/CDP4Dal.NetCore.Tests/Permission/PermissionServiceTestFixture.cs
+++ b/CDP4Dal.NetCore.Tests/Permission/PermissionServiceTestFixture.cs
@@ -70,6 +70,7 @@ public class PermissionServiceTestFixture
private PermissionService permissionService;
private CommonFileStore commonFileStore;
+ private File file;
[SetUp]
public void Setup()
@@ -103,6 +104,7 @@ public void Setup()
this.requirementsSpecification = new RequirementsSpecification(Guid.NewGuid(), this.assembler.Cache, this.uri);
this.requirement = new Requirement(Guid.NewGuid(), this.assembler.Cache, this.uri);
this.commonFileStore = new CommonFileStore(Guid.NewGuid(), this.assembler.Cache, this.uri);
+ this.file = new File(Guid.NewGuid(), this.assembler.Cache, this.uri);
this.sitedir.Model.Add(this.modelsetup);
this.sitedir.Person.Add(this.person);
@@ -134,6 +136,8 @@ public void Setup()
this.requirementsSpecification.Requirement.Add(this.requirement);
this.iteration.RequirementsSpecification.Add(this.requirementsSpecification);
this.model.CommonFileStore.Add(this.commonFileStore);
+ this.file.Owner = this.domain1;
+ this.commonFileStore.File.Add(this.file);
this.session.Setup(x => x.ActivePerson).Returns(this.person);
this.session.Setup(x => x.Assembler).Returns(this.assembler);
@@ -172,6 +176,7 @@ public void TestCanWriteFalseWithDefaultPermission()
Assert.That(this.permissionService.CanRead(this.model), Is.False);
Assert.That(this.permissionService.CanRead(this.iteration), Is.False);
+ Assert.That(this.permissionService.CanRead(this.file), Is.False);
}
[Test]
@@ -399,10 +404,39 @@ public void VerifyModifyIfOwnerForThingsThatAreDirectlyUnderEngineeringModel()
//Thing has other owner as User's participant
this.commonFileStore.Owner = this.domain2;
- Assert.That(this.permissionService.CanWrite(this.commonFileStore), Is.True);
+ Assert.That(this.permissionService.CanWrite(this.commonFileStore), Is.False);
Assert.That(this.permissionService.CanRead(this.commonFileStore), Is.True);
}
+ [Test]
+ public void VerifyModifyIfOwnerForThingsThatContainedInThingsThatAreDirectlyUnderEngineeringModel()
+ {
+ this.session.Setup(x => x.ActivePersonParticipants).Returns(new List { this.participant });
+ Assert.That(this.permissionService.CanWrite(this.model), Is.False);
+ Assert.That(this.permissionService.CanRead(this.model), Is.False);
+
+ var permission =
+ this.participantRole.ParticipantPermission.Single(x => x.ObjectClass == ClassKind.File);
+
+ permission.AccessRight = ParticipantAccessRightKind.MODIFY_IF_OWNER;
+
+ this.file.Owner = null;
+
+ //Thing has no owner
+ Assert.Throws(() => this.permissionService.CanWrite(this.file));
+ Assert.Throws(() => this.permissionService.CanRead(this.file));
+
+ //Thing has same owner as User's participant
+ this.file.Owner = this.domain1;
+ Assert.That(this.permissionService.CanWrite(this.file), Is.True);
+ Assert.That(this.permissionService.CanRead(this.file), Is.True);
+
+ //Thing has other owner as User's participant
+ this.file.Owner = this.domain2;
+ Assert.That(this.permissionService.CanWrite(this.file), Is.False);
+ Assert.That(this.permissionService.CanRead(this.file), Is.True);
+ }
+
[Test]
public void VerifySameAsSuperclassParticipantPermission()
{
diff --git a/CDP4Dal.Tests/Permission/PermissionServiceTestFixture.cs b/CDP4Dal.Tests/Permission/PermissionServiceTestFixture.cs
index 3c40f66c..99a7c120 100644
--- a/CDP4Dal.Tests/Permission/PermissionServiceTestFixture.cs
+++ b/CDP4Dal.Tests/Permission/PermissionServiceTestFixture.cs
@@ -2,20 +2,20 @@
//
// Copyright (c) 2015-2024 Starion Group S.A.
//
-// Author: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar
-//
+// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft, Yevhen Ikonnykov
+//
// This file is part of CDP4-COMET SDK Community Edition
-//
+//
// The CDP4-COMET SDK Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
-//
+//
// The CDP4-COMET SDK Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
-//
+//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -70,6 +70,7 @@ public class PermissionServiceTestFixture
private PermissionService permissionService;
private CommonFileStore commonFileStore;
+ private File file;
[SetUp]
public void Setup()
@@ -103,6 +104,7 @@ public void Setup()
this.requirementsSpecification = new RequirementsSpecification(Guid.NewGuid(), this.assembler.Cache, this.uri);
this.requirement = new Requirement(Guid.NewGuid(), this.assembler.Cache, this.uri);
this.commonFileStore = new CommonFileStore(Guid.NewGuid(), this.assembler.Cache, this.uri);
+ this.file = new File(Guid.NewGuid(), this.assembler.Cache, this.uri);
this.sitedir.Model.Add(this.modelsetup);
this.sitedir.Person.Add(this.person);
@@ -134,6 +136,8 @@ public void Setup()
this.requirementsSpecification.Requirement.Add(this.requirement);
this.iteration.RequirementsSpecification.Add(this.requirementsSpecification);
this.model.CommonFileStore.Add(this.commonFileStore);
+ this.file.Owner = this.domain1;
+ this.commonFileStore.File.Add(this.file);
this.session.Setup(x => x.ActivePerson).Returns(this.person);
this.session.Setup(x => x.Assembler).Returns(this.assembler);
@@ -172,6 +176,7 @@ public void TestCanWriteFalseWithDefaultPermission()
Assert.That(this.permissionService.CanRead(this.model), Is.False);
Assert.That(this.permissionService.CanRead(this.iteration), Is.False);
+ Assert.That(this.permissionService.CanRead(this.file), Is.False);
}
[Test]
@@ -399,10 +404,39 @@ public void VerifyModifyIfOwnerForThingsThatAreDirectlyUnderEngineeringModel()
//Thing has other owner as User's participant
this.commonFileStore.Owner = this.domain2;
- Assert.That(this.permissionService.CanWrite(this.commonFileStore), Is.True);
+ Assert.That(this.permissionService.CanWrite(this.commonFileStore), Is.False);
Assert.That(this.permissionService.CanRead(this.commonFileStore), Is.True);
}
+ [Test]
+ public void VerifyModifyIfOwnerForThingsThatContainedInThingsThatAreDirectlyUnderEngineeringModel()
+ {
+ this.session.Setup(x => x.ActivePersonParticipants).Returns(new List { this.participant });
+ Assert.That(this.permissionService.CanWrite(this.model), Is.False);
+ Assert.That(this.permissionService.CanRead(this.model), Is.False);
+
+ var permission =
+ this.participantRole.ParticipantPermission.Single(x => x.ObjectClass == ClassKind.File);
+
+ permission.AccessRight = ParticipantAccessRightKind.MODIFY_IF_OWNER;
+
+ this.file.Owner = null;
+
+ //Thing has no owner
+ Assert.Throws(() => this.permissionService.CanWrite(this.file));
+ Assert.Throws(() => this.permissionService.CanRead(this.file));
+
+ //Thing has same owner as User's participant
+ this.file.Owner = this.domain1;
+ Assert.That(this.permissionService.CanWrite(this.file), Is.True);
+ Assert.That(this.permissionService.CanRead(this.file), Is.True);
+
+ //Thing has other owner as User's participant
+ this.file.Owner = this.domain2;
+ Assert.That(this.permissionService.CanWrite(this.file), Is.False);
+ Assert.That(this.permissionService.CanRead(this.file), Is.True);
+ }
+
[Test]
public void VerifySameAsSuperclassParticipantPermission()
{
diff --git a/CDP4Dal/CDP4Dal.csproj b/CDP4Dal/CDP4Dal.csproj
index aa896207..850e04d1 100644
--- a/CDP4Dal/CDP4Dal.csproj
+++ b/CDP4Dal/CDP4Dal.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4Dal Community Edition
- 27.1.0
+ 27.2.0
CDP4 Data Access Layer library, a consumer of an ECSS-E-TM-10-25 Annex C API
Copyright © Starion Group S.A.
Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathanael, Ahmed
@@ -20,8 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
- [ADD] Use ExceptionHandlerService in Session
+ [FIX] PermissionService
README.md
diff --git a/CDP4Dal/Permission/PermissionService.cs b/CDP4Dal/Permission/PermissionService.cs
index be917ca1..1098c523 100644
--- a/CDP4Dal/Permission/PermissionService.cs
+++ b/CDP4Dal/Permission/PermissionService.cs
@@ -650,7 +650,7 @@ private bool CanWriteIfParticipantOwned(IOwnedThing ownedThing)
if (thing.Container is EngineeringModel currentModel)
{
- return this.Session.OpenIterations.Where(x => x.Key.Container == currentModel).Select(x => x.Value).Any();
+ return this.Session.OpenIterations.Where(x => x.Key.Container == currentModel && x.Value.Item2.Domain.Contains(ownedThing.Owner)).Select(x => x.Value).Any();
}
//Check if the ownedThing domain is contained in the participant domains
@@ -669,13 +669,30 @@ private bool TryGetThingParticipant(Thing thing, out Participant participant)
var iteration = thing is Iteration it ? it : thing.GetContainerOfType();
participant = null;
- if (iteration != null
- && this.Session.OpenIterations.TryGetValue(iteration, out var participation)
+ if (iteration != null)
+ {
+ if (this.Session.OpenIterations.TryGetValue(iteration, out var participation)
&& participation.Item1 != null
&& participation.Item2 != null)
+ {
+ participant = participation.Item2;
+ return true;
+ }
+ }
+ else
{
- participant = participation.Item2;
- return true;
+ // Check TopContainer, for contained Things on a non Iteration Thing directly under EngineeringModel,
+ // like EngineeringModel=>CommonFileStore=>File
+ if (thing.TopContainer is EngineeringModel currentModel)
+ {
+ var iterations = this.Session.OpenIterations.FirstOrDefault(x => x.Key.Container == currentModel);
+
+ if (iterations.Key != null)
+ {
+ participant = iterations.Value.Item2;
+ return true;
+ }
+ }
}
return false;
diff --git a/CDP4DalCommon/CDP4DalCommon.csproj b/CDP4DalCommon/CDP4DalCommon.csproj
index cf93b6e6..153ded70 100644
--- a/CDP4DalCommon/CDP4DalCommon.csproj
+++ b/CDP4DalCommon/CDP4DalCommon.csproj
@@ -5,7 +5,7 @@
Starion Group S.A.
latest
CDP4DalCommon Community Edition
- 27.1.0
+ 27.2.0
CDP4 Common Class Library that contains common types for any CDP4 server and the CDP4Dal
Copyright © Starion Group S.A.
Sam, Alex, Alexander, Nathanael, Antoine, Omar, Jaime
@@ -21,7 +21,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
true
diff --git a/CDP4JsonFileDal/CDP4JsonFileDal.csproj b/CDP4JsonFileDal/CDP4JsonFileDal.csproj
index 3d6ae584..aa030978 100644
--- a/CDP4JsonFileDal/CDP4JsonFileDal.csproj
+++ b/CDP4JsonFileDal/CDP4JsonFileDal.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4JsonFileDal Community Edition
- 27.1.0
+ 27.2.0
CDP4 Json File Dal Plugin
Copyright © Starion Group S.A.
Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathanael
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4JsonSerializer/CDP4JsonSerializer.csproj b/CDP4JsonSerializer/CDP4JsonSerializer.csproj
index e65ade8c..9d84e1a9 100644
--- a/CDP4JsonSerializer/CDP4JsonSerializer.csproj
+++ b/CDP4JsonSerializer/CDP4JsonSerializer.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4JsonSerializer Community Edition
- 27.1.0
+ 27.2.0
CDP4 JSON Serialization Library
Copyright © Starion Group S.A.
Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathanael
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25 JSON
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4MessagePackSerializer/CDP4MessagePackSerializer.csproj b/CDP4MessagePackSerializer/CDP4MessagePackSerializer.csproj
index 89e78825..53675bc1 100644
--- a/CDP4MessagePackSerializer/CDP4MessagePackSerializer.csproj
+++ b/CDP4MessagePackSerializer/CDP4MessagePackSerializer.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4MessagePackSerializer Community Edition
- 27.1.0
+ 27.2.0
CDP4 MessagePack Serialization Library
Copyright © Starion Group S.A.
Sam, Alex, Alexander, Nathanael, Antoine, Omar
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25 MessagePack
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4Reporting/CDP4Reporting.csproj b/CDP4Reporting/CDP4Reporting.csproj
index 4ff092f1..a3a5ad92 100644
--- a/CDP4Reporting/CDP4Reporting.csproj
+++ b/CDP4Reporting/CDP4Reporting.csproj
@@ -4,7 +4,7 @@
netstandard2.0
Starion Group S.A.
CDP4Reporting Community Edition
- 27.1.0
+ 27.2.0
CDP4 Reporting
Copyright © Starion Group S.A.
Sam, Alex, Alexander
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
latest
README.md
diff --git a/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj b/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj
index 17de439c..77db8ffc 100644
--- a/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj
+++ b/CDP4RequirementsVerification/CDP4RequirementsVerification.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4RequirementsVerification Community Edition
- 27.1.0
+ 27.2.0
CDP4 Class Library that provides requirement verification
Copyright © Starion Group S.A.
Sam, Alex, Alexander, Yevhen, Nathanael
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4Rules/CDP4Rules.csproj b/CDP4Rules/CDP4Rules.csproj
index 548b4ee7..4c2b1bd0 100644
--- a/CDP4Rules/CDP4Rules.csproj
+++ b/CDP4Rules/CDP4Rules.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4Rules Community Edition
- 27.1.0
+ 27.2.0
CDP4 Class Library that provides Model Analysis and Rule Checking
Copyright © Starion Group S.A.
Sam, Alex, Alexander, Yevhen, Nathanael
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4ServicesDal/CDP4ServicesDal.csproj b/CDP4ServicesDal/CDP4ServicesDal.csproj
index 901f5ffd..8e3ff15e 100644
--- a/CDP4ServicesDal/CDP4ServicesDal.csproj
+++ b/CDP4ServicesDal/CDP4ServicesDal.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4ServicesDal Community Edition
- 27.1.0
+ 27.2.0
CDP4ServicesDal Dal Plugin
Copyright © Starion Group S.A.
Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathanael
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4ServicesMessaging/CDP4ServicesMessaging.csproj b/CDP4ServicesMessaging/CDP4ServicesMessaging.csproj
index 6ee664ca..5046abe9 100644
--- a/CDP4ServicesMessaging/CDP4ServicesMessaging.csproj
+++ b/CDP4ServicesMessaging/CDP4ServicesMessaging.csproj
@@ -4,7 +4,7 @@
netstandard2.0
Starion Group S.A.
CDP4Common Community Edition
- 27.1.0
+ 27.2.0
CDP4 Services Messaging is a Class Library that contains clients and messages class that can be used for inter services communication
Copyright © Starion Group S.A.
Sam, Alex, Alexander, Nathanael, Antoine
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
latest
diff --git a/CDP4Web/CDP4Web.csproj b/CDP4Web/CDP4Web.csproj
index cb66ec5b..9a70060a 100644
--- a/CDP4Web/CDP4Web.csproj
+++ b/CDP4Web/CDP4Web.csproj
@@ -5,7 +5,7 @@
latest
Starion Group S.A.
CDP4Web Community Edition
- 27.1.0
+ 27.2.0
CDP4Web Dedicated Sdk for CDPServicesDal
Copyright © Starion Group S.A.
Sam, Alex, Alexander, Nathanael, Antoine, Omar, Jaime
@@ -21,7 +21,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md
diff --git a/CDP4WspDal/CDP4WspDal.csproj b/CDP4WspDal/CDP4WspDal.csproj
index 1f24232d..bea2a923 100644
--- a/CDP4WspDal/CDP4WspDal.csproj
+++ b/CDP4WspDal/CDP4WspDal.csproj
@@ -4,7 +4,7 @@
net48;netstandard2.0
Starion Group S.A.
CDP4WspDal Community Edition
- 27.1.0
+ 27.2.0
CDP4 WSP Dal Plugin
Copyright © Starion Group S.A.
Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathanael
@@ -20,7 +20,7 @@
CDP COMET ECSS-E-TM-10-25
LGPL-3.0-only
- [BUMP] To CDP4Common 27.1.0
+ [BUMP] To CDP4Common 27.2.0
README.md