Skip to content

Commit 617e8e4

Browse files
committed
[all] 같은 계정이라도 다른 토큰을 가진 사용자를 추방할 수 있도록 수정
1 parent 952647f commit 617e8e4

14 files changed

Lines changed: 70 additions & 43 deletions

File tree

client/Ntreev.Crema.Client.Framework/DomainUserDescriptor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public DomainUserDescriptor(Authentication authentication, IDomainUser domainUse
9090
[DescriptorProperty(nameof(domainUserState))]
9191
public DomainUserState DomainUserState => this.domainUserState;
9292

93+
public object Owner => this.owner;
94+
9395
[DescriptorProperty]
9496
public bool IsOnline => DomainUserDescriptorUtility.IsOnline(this.authentication, this);
9597

client/Ntreev.Crema.Client.Framework/IDomainUserDescriptor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public interface IDomainUserDescriptor : INotifyPropertyChanged
3939

4040
DomainUserState DomainUserState { get; }
4141

42+
object Owner { get; }
43+
4244
bool IsOnline { get; }
4345

4446
bool IsModified { get; }

client/Ntreev.Crema.Client.Users/DomainUserUtility.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using System.Linq;
2727
using System.Text;
2828
using System.Threading.Tasks;
29+
using Ntreev.Crema.Client.Users.PropertyItems.ViewModels;
2930

3031
namespace Ntreev.Crema.Client.Users
3132
{
@@ -48,9 +49,18 @@ public static bool CanSetOwner(Authentication authentication, IDomainUserDescrip
4849
throw new ArgumentNullException(nameof(authentication));
4950
if (descriptor == null)
5051
throw new ArgumentNullException(nameof(descriptor));
52+
if (DomainUserDescriptorUtility.IsOwner(authentication, descriptor) && authentication.Token == descriptor.Token)
53+
return false;
54+
if (authentication.Authority == Authority.Admin)
55+
return true;
56+
if (descriptor.Owner is EditorsViewModel editorsViewModel)
57+
{
58+
var isOwnerByUserId = editorsViewModel.Users.OfType<DomainUserTreeItemBase>().Any(user => user.UserID == descriptor.UserID && user.IsOwner);
59+
if (isOwnerByUserId) return true;
60+
}
5161
if (DomainUserDescriptorUtility.IsOwner(authentication, descriptor) == false)
5262
return false;
53-
return authentication.Authority == Authority.Admin;
63+
return false;
5464
}
5565

5666
public static bool CanKick(Authentication authentication, IDomainUserDescriptor descriptor)
@@ -61,7 +71,11 @@ public static bool CanKick(Authentication authentication, IDomainUserDescriptor
6171
throw new ArgumentNullException(nameof(descriptor));
6272
if (DomainUserDescriptorUtility.IsOwner(authentication, descriptor) == true)
6373
return false;
64-
return authentication.Authority == Authority.Admin;
74+
if (authentication.Authority == Authority.Admin)
75+
return true;
76+
if (authentication.ID == descriptor.UserID && authentication.Token != descriptor.Token)
77+
return true;
78+
return false;
6579
}
6680

6781
public static async Task<bool> SendMessageAsync(Authentication authentication, IDomainUserDescriptor descriptor)

client/Ntreev.Crema.Services/Ntreev.Crema.Services.csproj

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@
119119
<DesignTime>True</DesignTime>
120120
<DependentUpon>Reference.svcmap</DependentUpon>
121121
</Compile>
122-
<Compile Include="Service References\UserService\Reference.cs">
122+
<Compile Include="Service References\DomainService\Reference.cs">
123123
<AutoGen>True</AutoGen>
124124
<DesignTime>True</DesignTime>
125125
<DependentUpon>Reference.svcmap</DependentUpon>
126126
</Compile>
127-
<Compile Include="Properties\Resources.Designer.cs">
127+
<Compile Include="Service References\UserService\Reference.cs">
128128
<AutoGen>True</AutoGen>
129129
<DesignTime>True</DesignTime>
130-
<DependentUpon>Resources.resx</DependentUpon>
130+
<DependentUpon>Reference.svcmap</DependentUpon>
131131
</Compile>
132-
<Compile Include="Service References\DomainService\Reference.cs">
132+
<Compile Include="Properties\Resources.Designer.cs">
133133
<AutoGen>True</AutoGen>
134134
<DesignTime>True</DesignTime>
135-
<DependentUpon>Reference.svcmap</DependentUpon>
135+
<DependentUpon>Resources.resx</DependentUpon>
136136
</Compile>
137137
<Compile Include="Domains\Domain.cs" />
138138
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -206,8 +206,8 @@
206206
<None Include="Service References\DomainService\schemas.ntreev.com.xsd">
207207
<SubType>Designer</SubType>
208208
</None>
209-
<None Include="Service References\DomainService\service1.wsdl" />
210-
<None Include="Service References\DomainService\service21.xsd">
209+
<None Include="Service References\DomainService\service.wsdl" />
210+
<None Include="Service References\DomainService\service.xsd">
211211
<SubType>Designer</SubType>
212212
</None>
213213
<None Include="Service References\DomainService\System.xsd">
@@ -242,18 +242,6 @@
242242
<WCFMetadataStorage Include="Service References\DomainService\" />
243243
<WCFMetadataStorage Include="Service References\UserService\" />
244244
</ItemGroup>
245-
<ItemGroup>
246-
<None Include="Service References\DomainService\configuration91.svcinfo" />
247-
</ItemGroup>
248-
<ItemGroup>
249-
<None Include="Service References\DomainService\configuration.svcinfo" />
250-
</ItemGroup>
251-
<ItemGroup>
252-
<None Include="Service References\DomainService\Reference.svcmap">
253-
<Generator>WCF Proxy Generator</Generator>
254-
<LastGenOutput>Reference.cs</LastGenOutput>
255-
</None>
256-
</ItemGroup>
257245
<ItemGroup>
258246
<ProjectReference Include="..\..\common\Ntreev.Crema.Data\Ntreev.Crema.Data.csproj">
259247
<Project>{04aeb614-3510-4064-99af-0aa807c7f957}</Project>
@@ -324,6 +312,18 @@
324312
<LastGenOutput>Reference.cs</LastGenOutput>
325313
</None>
326314
</ItemGroup>
315+
<ItemGroup>
316+
<None Include="Service References\DomainService\configuration91.svcinfo" />
317+
</ItemGroup>
318+
<ItemGroup>
319+
<None Include="Service References\DomainService\configuration.svcinfo" />
320+
</ItemGroup>
321+
<ItemGroup>
322+
<None Include="Service References\DomainService\Reference.svcmap">
323+
<Generator>WCF Proxy Generator</Generator>
324+
<LastGenOutput>Reference.cs</LastGenOutput>
325+
</None>
326+
</ItemGroup>
327327
<Import Project="..\..\common\Ntreev.Crema.AssemblyInfo\Ntreev.Crema.AssemblyInfo.projitems" Label="Shared" />
328328
<Import Project="..\..\common\Ntreev.Crema.Services.Sharing\Ntreev.Crema.Services.Sharing.projitems" Label="Shared" />
329329
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

client/Ntreev.Crema.Services/Service References/DataBaseCollectionService/schemas.ntreev.com.xsd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@
255255
<IsValueType xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</IsValueType>
256256
</xs:appinfo>
257257
</xs:annotation>
258-
<xs:sequence />
258+
<xs:sequence>
259+
<xs:element minOccurs="0" name="Xml" nillable="true" type="xs:string" />
260+
</xs:sequence>
259261
</xs:complexType>
260262
<xs:element name="AuthenticationInfo" nillable="true" type="tns:AuthenticationInfo" />
261263
<xs:complexType name="ArrayOfDataBaseState">

client/Ntreev.Crema.Services/Service References/DomainService/Reference.svcmap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="c2caad76-9ea7-40e6-84da-38292c019ece" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
2+
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="57940d39-51f2-4b0b-b5cf-8439c390348e" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
33
<ClientOptions>
44
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
55
<EnableDataBinding>true</EnableDataBinding>
@@ -21,12 +21,12 @@
2121
<MetadataSource Address="net.tcp://localhost:4004/DomainService/mex" Protocol="mex" SourceId="1" />
2222
</MetadataSources>
2323
<Metadata>
24-
<MetadataFile FileName="www.ntreev.com.wsdl" MetadataType="Wsdl" ID="a95a1d01-014b-4652-b5c2-64747594ccfd" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
25-
<MetadataFile FileName="service1.wsdl" MetadataType="Wsdl" ID="43abe183-1cac-4a1e-a348-b8b6f0f16790" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
26-
<MetadataFile FileName="service21.xsd" MetadataType="Schema" ID="c524cdbb-5db3-4ef1-89bd-38a4d896a427" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
27-
<MetadataFile FileName="System.xsd" MetadataType="Schema" ID="d01de50d-630c-4ad7-9f70-a19ad8ec8e7c" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
28-
<MetadataFile FileName="www.ntreev.com.xsd" MetadataType="Schema" ID="62c3cd67-b2b9-4d80-815f-a0b0e0690a69" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
29-
<MetadataFile FileName="schemas.ntreev.com.xsd" MetadataType="Schema" ID="2e6f4ef5-1a04-4de2-9d8a-5c5eb9b543f9" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
24+
<MetadataFile FileName="www.ntreev.com.wsdl" MetadataType="Wsdl" ID="270d8100-a85c-46b2-ba29-26944550031d" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
25+
<MetadataFile FileName="service.wsdl" MetadataType="Wsdl" ID="3a543b69-f2c9-491b-a590-defc384e9d4d" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
26+
<MetadataFile FileName="service.xsd" MetadataType="Schema" ID="7e96882b-5e44-4134-82ec-b5a611d86ce7" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
27+
<MetadataFile FileName="System.xsd" MetadataType="Schema" ID="afce6121-dad1-4d2d-90ba-773edb10da26" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
28+
<MetadataFile FileName="www.ntreev.com.xsd" MetadataType="Schema" ID="c39db76c-dbf8-4478-b05f-0d8a2d303862" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
29+
<MetadataFile FileName="schemas.ntreev.com.xsd" MetadataType="Schema" ID="0c0eb5f1-13c2-4226-a5ff-b4468036ae3b" SourceId="1" SourceUrl="net.tcp://localhost:4004/DomainService/mex" />
3030
</Metadata>
3131
<Extensions>
3232
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />

client/Ntreev.Crema.Services/Service References/DomainService/configuration.svcinfo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
33
<behaviors />
44
<bindings>
5-
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data name=&quot;NetTcpBinding_IDomainService&quot;&gt;&lt;security mode=&quot;None&quot;&gt;&lt;transport sslProtocols=&quot;None&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="netTcpBinding" name="NetTcpBinding_IDomainService" />
5+
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data name=&quot;NetTcpBinding_IDomainService1&quot;&gt;&lt;security mode=&quot;None&quot;&gt;&lt;transport sslProtocols=&quot;None&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="netTcpBinding" name="NetTcpBinding_IDomainService1" />
66
</bindings>
77
<endpoints>
8-
<endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://localhost:4004/DomainService&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IDomainService&quot; contract=&quot;DomainService.IDomainService&quot; name=&quot;NetTcpBinding_IDomainService&quot; /&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://localhost:4004/DomainService&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IDomainService&quot; contract=&quot;DomainService.IDomainService&quot; name=&quot;NetTcpBinding_IDomainService&quot; /&gt;" contractName="DomainService.IDomainService" name="NetTcpBinding_IDomainService" />
8+
<endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://localhost:4004/DomainService&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IDomainService1&quot; contract=&quot;DomainService.IDomainService&quot; name=&quot;NetTcpBinding_IDomainService&quot; /&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://localhost:4004/DomainService&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IDomainService1&quot; contract=&quot;DomainService.IDomainService&quot; name=&quot;NetTcpBinding_IDomainService&quot; /&gt;" contractName="DomainService.IDomainService" name="NetTcpBinding_IDomainService" />
99
</endpoints>
1010
</configurationSnapshot>

client/Ntreev.Crema.Services/Service References/DomainService/configuration91.svcinfo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="kdlsig6NoQpsi6CSGhg7WDcuVGc=">
2+
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="XZjd22ete9Lj3DOBw1+c8TF2Vp4=">
33
<bindingConfigurations>
4-
<bindingConfiguration bindingType="netTcpBinding" name="NetTcpBinding_IDomainService">
4+
<bindingConfiguration bindingType="netTcpBinding" name="NetTcpBinding_IDomainService1">
55
<properties>
66
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
7-
<serializedValue>NetTcpBinding_IDomainService</serializedValue>
7+
<serializedValue>NetTcpBinding_IDomainService1</serializedValue>
88
</property>
99
<property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
1010
<serializedValue />
@@ -121,7 +121,7 @@
121121
</bindingConfiguration>
122122
</bindingConfigurations>
123123
<endpoints>
124-
<endpoint name="NetTcpBinding_IDomainService" contract="DomainService.IDomainService" bindingType="netTcpBinding" address="net.tcp://localhost:4004/DomainService" bindingConfiguration="NetTcpBinding_IDomainService">
124+
<endpoint name="NetTcpBinding_IDomainService" contract="DomainService.IDomainService" bindingType="netTcpBinding" address="net.tcp://localhost:4004/DomainService" bindingConfiguration="NetTcpBinding_IDomainService1">
125125
<properties>
126126
<property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
127127
<serializedValue>net.tcp://localhost:4004/DomainService</serializedValue>
@@ -133,7 +133,7 @@
133133
<serializedValue>netTcpBinding</serializedValue>
134134
</property>
135135
<property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
136-
<serializedValue>NetTcpBinding_IDomainService</serializedValue>
136+
<serializedValue>NetTcpBinding_IDomainService1</serializedValue>
137137
</property>
138138
<property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
139139
<serializedValue>DomainService.IDomainService</serializedValue>

client/Ntreev.Crema.Services/Service References/DomainService/service1.wsdl renamed to client/Ntreev.Crema.Services/Service References/DomainService/service.wsdl

File renamed without changes.

client/Ntreev.Crema.Services/Service References/DomainService/service21.xsd renamed to client/Ntreev.Crema.Services/Service References/DomainService/service.xsd

File renamed without changes.

0 commit comments

Comments
 (0)