Skip to content

Commit 58b5679

Browse files
committed
[all] 중복 로그인 허용 상태를 설정할 수 있는 방법 제공
1 parent ea8cfbd commit 58b5679

36 files changed

Lines changed: 245 additions & 83 deletions

File tree

client/Ntreev.Crema.Client.Base/Services/ViewModels/CremaAppHostViewModel.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,16 @@ public async void Login(string address, string userID, SecureString password, st
157157
{
158158
this.ProgressMessage = Resources.Message_ConnectingToServer;
159159

160-
// TODO: 3.7
161-
//if (await this.cremaHost.Dispatcher.InvokeAsync(() => CremaBootstrapper.IsOnline(address, userID, password)) == true)
162-
//{
163-
// if (AppMessageBox.ShowQuestion(Resources.Message_SameIDConnected) == false)
164-
// {
165-
// this.ProgressMessage = string.Empty;
166-
// this.EndProgress();
167-
// this.HasError = false;
168-
// return;
169-
// }
170-
//}
160+
if (await this.cremaHost.Dispatcher.InvokeAsync(() => CremaBootstrapper.CanLogin(address, userID, password)) == false)
161+
{
162+
if (AppMessageBox.ShowQuestion(Resources.Message_SameIDConnected) == false)
163+
{
164+
this.ProgressMessage = string.Empty;
165+
this.EndProgress();
166+
this.HasError = false;
167+
return;
168+
}
169+
}
171170
await this.OpenAsync(address, userID, password);
172171

173172
if (dataBaseName != string.Empty)

client/Ntreev.Crema.Client.Users/Dialogs/ViewModels/ChangePasswordViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public async void Change()
102102
try
103103
{
104104
this.BeginProgress(Resources.Message_Change);
105-
await this.user.Dispatcher.InvokeAsync(() => this.user.ChangeUserInfo(this.authentication, this.Password, this.NewPassword, null, null));
105+
await this.user.Dispatcher.InvokeAsync(() => this.user.ChangeUserInfo(this.authentication, this.Password, this.NewPassword, null, null, null));
106106
this.EndProgress();
107107
this.TryClose(true);
108108
AppMessageBox.ShowInfo(Resources.Message_ChangeComplete);

client/Ntreev.Crema.Client.Users/Dialogs/ViewModels/ChangeUserViewModel.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class ChangeUserViewModel : ModalDialogAppBase
3939
private SecureString password;
4040
private string userName;
4141
private Authority authority;
42+
private bool allowMultiLogin;
4243

4344
private string oldUserName;
4445
private Authority oldAuthority;
@@ -51,6 +52,7 @@ private ChangeUserViewModel(Authentication authentication, IUser user)
5152
this.userID = user.ID;
5253
this.userName = this.oldUserName = user.UserName;
5354
this.authority = this.oldAuthority = user.Authority;
55+
this.allowMultiLogin = user.UserInfo.AllowMultiLogin;
5456
this.DisplayName = Resources.Title_ChangeUserInfo;
5557
}
5658

@@ -122,6 +124,17 @@ public Authority Authority
122124
}
123125
}
124126

127+
public bool AllowMultiLogin
128+
{
129+
get { return this.allowMultiLogin; }
130+
set
131+
{
132+
this.allowMultiLogin = value;
133+
this.NotifyOfPropertyChange(nameof(this.AllowMultiLogin));
134+
this.NotifyOfPropertyChange(nameof(this.CanChange));
135+
}
136+
}
137+
125138
public bool IsCurrentUser
126139
{
127140
get { return this.authentication.ID == this.userID; }
@@ -143,7 +156,7 @@ public async void Change()
143156
var authority = this.oldAuthority == this.authority ? null : (Authority?)this.authority;
144157
var userName = this.oldUserName == this.userName ? null : this.userName;
145158
var password = this.Password;
146-
await this.user.Dispatcher.InvokeAsync(() => this.user.ChangeUserInfo(this.authentication, password, password, userName, authority));
159+
await this.user.Dispatcher.InvokeAsync(() => this.user.ChangeUserInfo(this.authentication, password, password, userName, authority, allowMultiLogin));
147160
this.EndProgress();
148161
this.TryClose(true);
149162
AppMessageBox.Show(Resources.Message_ChangeComplete);

client/Ntreev.Crema.Client.Users/Dialogs/ViewModels/NewUserViewModel.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class NewUserViewModel : ModalDialogBase
3939
private string userID;
4040
private SecureString password;
4141
private string userName;
42+
private bool allowMultiLogin;
4243
private Authority authority = Authority.Member;
4344

4445
private NewUserViewModel(Authentication authentication, IUserCategory category)
@@ -75,7 +76,7 @@ public async void Create()
7576
try
7677
{
7778
this.BeginProgress(Resources.Message_NewUser);
78-
await this.category.Dispatcher.InvokeAsync(() => this.category.AddNewUser(this.authentication, this.ID, this.Password, this.UserName, this.Authority));
79+
await this.category.Dispatcher.InvokeAsync(() => this.category.AddNewUser(this.authentication, this.ID, this.Password, this.UserName, this.Authority, this.allowMultiLogin));
7980
this.EndProgress();
8081
this.TryClose(true);
8182
AppMessageBox.Show(Resources.Message_NewUserComplete);
@@ -147,6 +148,17 @@ public Authority Authority
147148
}
148149
}
149150

151+
public bool AllowMultiLogin
152+
{
153+
get { return this.allowMultiLogin; }
154+
set
155+
{
156+
this.allowMultiLogin = value;
157+
this.NotifyOfPropertyChange(nameof(this.AllowMultiLogin));
158+
this.NotifyOfPropertyChange(nameof(this.CanCreate));
159+
}
160+
}
161+
150162
public IEnumerable<Authority> Authorities
151163
{
152164
get

client/Ntreev.Crema.Client.Users/Dialogs/Views/ChangeUserView.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
6868
<ComboBox nmfc:PropertyItemsControl.Header="{x:Static p:Resources.Label_Authority}" Style="{StaticResource Label_ComboBox_Style}"
6969
ItemsSource="{Binding Authorities}" SelectedItem="{Binding Authority}" />
7070
<TextBox x:Name="UserName" nmfc:PropertyItemsControl.Header="{x:Static p:Resources.Label_Name}" />
71+
<CheckBox nmfc:PropertyItemsControl.Header="{x:Static p:Resources.Label_AllowMultiLogin}"
72+
IsChecked="{Binding AllowMultiLogin, Mode=TwoWay}" />
7173
</nmfc:PropertyItemsControl>
7274
<Button x:Name="Change" Content="{x:Static p:Resources.Button_Change}"
7375
Style="{DynamicResource Dialog_Button_Style}" IsDefault="True" />

client/Ntreev.Crema.Client.Users/Dialogs/Views/NewUserView.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4949
SelectedItem="{Binding Authority}" ItemsSource="{Binding Authorities}" />
5050
<TextBox nmfc:PropertyItemsControl.Header="{x:Static p:Resources.Label_Name}"
5151
Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
52+
<CheckBox nmfc:PropertyItemsControl.Header="{x:Static p:Resources.Label_AllowMultiLogin}"
53+
IsChecked="{Binding AllowMultiLogin, Mode=TwoWay}" />
5254
</nmfc:PropertyItemsControl>
5355
<Button x:Name="Create" Content="{x:Static p:Resources.Button_Create}" Style="{StaticResource Dialog_Button_Style}" IsDefault="True" />
5456
</StackPanel>

client/Ntreev.Crema.Client.Users/Properties/Resources.Designer.cs

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/Ntreev.Crema.Client.Users/Properties/Resources.ko-KR.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,7 @@
321321
<data name="Title_UserDomainList" xml:space="preserve">
322322
<value>사용자 도메인 목록</value>
323323
</data>
324+
<data name="Label_AllowMultiLogin" xml:space="preserve">
325+
<value>중복 로그인 허용</value>
326+
</data>
324327
</root>

client/Ntreev.Crema.Client.Users/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,7 @@
321321
<data name="Title_UserDomainList" xml:space="preserve">
322322
<value>User Domain List</value>
323323
</data>
324+
<data name="Label_AllowMultiLogin" xml:space="preserve">
325+
<value>Allow Multi Login</value>
326+
</data>
324327
</root>

client/Ntreev.Crema.Services/CremaBootstrapper.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ public static bool IsOnline(string address, string userID, SecureString password
7171
}
7272
}
7373

74+
public static bool CanLogin(string address, string userID, SecureString password)
75+
{
76+
var serviceClient = DescriptorServiceFactory.CreateServiceClient(address);
77+
serviceClient.Open();
78+
try
79+
{
80+
return serviceClient.CanLogin(userID, UserContext.Encrypt(userID, password));
81+
}
82+
finally
83+
{
84+
serviceClient.Close();
85+
}
86+
}
87+
7488
public static DataBaseInfo[] GetDataBases(string address)
7589
{
7690
var serviceClient = DescriptorServiceFactory.CreateServiceClient(address);

0 commit comments

Comments
 (0)