diff --git a/Borepin/Borepin/Borepin.csproj b/Borepin/Borepin/Borepin.csproj
index 411cfd3..a49038b 100644
--- a/Borepin/Borepin/Borepin.csproj
+++ b/Borepin/Borepin/Borepin.csproj
@@ -56,6 +56,9 @@
ScanURNPage.xaml
+
+ ProfilePage.xaml
+
UserPage.xaml
diff --git a/Borepin/Borepin/Model/UserVisualize.cs b/Borepin/Borepin/Model/UserVisualize.cs
index 073da2a..399dc64 100644
--- a/Borepin/Borepin/Model/UserVisualize.cs
+++ b/Borepin/Borepin/Model/UserVisualize.cs
@@ -1,4 +1,4 @@
-using FabAccessAPI.Schema;
+ using FabAccessAPI.Schema;
using Prism.Mvvm;
namespace Borepin.Model
diff --git a/Borepin/Borepin/Page/AddUserPage.xaml b/Borepin/Borepin/Page/AddUserPage.xaml
index fb4723b..9cdceb5 100644
--- a/Borepin/Borepin/Page/AddUserPage.xaml
+++ b/Borepin/Borepin/Page/AddUserPage.xaml
@@ -2,8 +2,14 @@
+
+
+
+
+
diff --git a/Borepin/Borepin/Page/UserPage.xaml b/Borepin/Borepin/Page/UserPage.xaml
index 776fd91..9a3bf92 100644
--- a/Borepin/Borepin/Page/UserPage.xaml
+++ b/Borepin/Borepin/Page/UserPage.xaml
@@ -21,7 +21,7 @@
-
+
diff --git a/Borepin/Borepin/PageModel/AddUserPageModel.cs b/Borepin/Borepin/PageModel/AddUserPageModel.cs
index efd9a83..3320dc7 100644
--- a/Borepin/Borepin/PageModel/AddUserPageModel.cs
+++ b/Borepin/Borepin/PageModel/AddUserPageModel.cs
@@ -1,13 +1,10 @@
using Borepin.Base;
using Prism.Commands;
using Prism.Navigation;
-using System.Threading.Tasks;
using System.Windows.Input;
using FabAccessAPI.Schema;
-using Borepin.Model;
using Prism.Services;
using Borepin.Service;
-using Borepin.Base.Exceptions;
using Capnp.Rpc;
using System;
using static FabAccessAPI.Schema.UserSystem.ManageInterface;
@@ -66,7 +63,7 @@ namespace Borepin.PageModel
case AddUserErrorEnum.alreadyExists:
Device.BeginInvokeOnMainThread(async () =>
{
- await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
+ await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AddUserFailed, Resources.Text.TextResource.ALERT_UserExist, Resources.Text.TextResource.OK).ConfigureAwait(false);
IsBusy = false;
});
@@ -74,7 +71,7 @@ namespace Borepin.PageModel
case AddUserErrorEnum.usernameInvalid:
Device.BeginInvokeOnMainThread(async () =>
{
- await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, "Unable to connect to server.", Resources.Text.TextResource.OK).ConfigureAwait(false);
+ await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AddUserFailed, Resources.Text.TextResource.ALERT_UsernameInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
IsBusy = false;
});
@@ -82,7 +79,7 @@ namespace Borepin.PageModel
case AddUserErrorEnum.passwordInvalid:
Device.BeginInvokeOnMainThread(async () =>
{
- await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
+ await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AddUserFailed, Resources.Text.TextResource.ALERT_PasswordInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
IsBusy = false;
});
diff --git a/Borepin/Borepin/PageModel/MainPageModel.cs b/Borepin/Borepin/PageModel/MainPageModel.cs
index 4860bfd..296c69b 100644
--- a/Borepin/Borepin/PageModel/MainPageModel.cs
+++ b/Borepin/Borepin/PageModel/MainPageModel.cs
@@ -30,8 +30,8 @@ namespace Borepin.PageModel
#region LoadData
public override Task LoadAPIData()
{
- //UserSystem.ManageInterface_Proxy manageInterface = (UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage;
- //CanManageUsers = !manageInterface.IsNull;
+ UserSystem.ManageInterface_Proxy manageInterface = (UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage;
+ CanManageUsers = !manageInterface.IsNull;
return Task.CompletedTask;
}
diff --git a/Borepin/Borepin/PageModel/UserPageModel.cs b/Borepin/Borepin/PageModel/UserPageModel.cs
index 37810aa..524f44c 100644
--- a/Borepin/Borepin/PageModel/UserPageModel.cs
+++ b/Borepin/Borepin/PageModel/UserPageModel.cs
@@ -24,14 +24,15 @@ namespace Borepin.PageModel
#region Private Fields
private string _ID;
private User _User;
- private bool IsDialog = false;
private IDialogService _DialogService;
+ private bool _IsDialog;
#endregion
#region Contructors
public UserPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, IDialogService dialogService) : base(navigationService, pageDialogService, apiService)
{
_DialogService = dialogService;
+ DeleteCommand = new DelegateCommand(DeleteCommandExecute);
}
#endregion
@@ -41,6 +42,10 @@ namespace Borepin.PageModel
if(instance is string)
{
_ID = instance as string;
+ }
+ else if(instance == null && _IsDialog)
+ {
+
}
else
{
@@ -52,6 +57,11 @@ namespace Borepin.PageModel
public override async Task LoadAPIData()
{
+ if(_IsDialog)
+ {
+ return;
+ }
+
_User = (await _API.Session.UserSystem.Search.GetUserByName(_ID).ConfigureAwait(false)).Just;
UserItem = new UserVisualize(_User);
UserItem.LoadData();
@@ -67,7 +77,7 @@ namespace Borepin.PageModel
{
role,
_User,
- user_role_list.Contains(role)
+ user_role_list.Exists(x => string.Equals(x.Name, role.Name, StringComparison.Ordinal))
};
await new_viewmodel.LoadInstance(array).ConfigureAwait(false);
@@ -78,7 +88,7 @@ namespace Borepin.PageModel
PermissionSelectViewModel_List = viewmodel_list;
CanAdmin = !((UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage).IsNull;
- CanManage = !((User.AdminInterface_Proxy)_User.Manage).IsNull;
+ CanManage = !((User.ManageInterface_Proxy)_User.Manage).IsNull;
}
#endregion
@@ -129,7 +139,7 @@ namespace Borepin.PageModel
{ "instance", _User },
};
- IsDialog = true;
+ _IsDialog = true;
_DialogService.ShowDialog("ConfirmDialog", parameters, DeleteCommandExecute_Dialog);
}
@@ -137,10 +147,16 @@ namespace Borepin.PageModel
{
if (string.Equals(result.Parameters.GetValue("result"), "confirm", StringComparison.Ordinal))
{
- if(_API.IsConnected)
+ IsBusy = true;
+ if (_API.IsConnected)
{
try
{
+ foreach(PermissionSelectViewModel viewModel in PermissionSelectViewModel_List)
+ {
+ viewModel.Dispose();
+ }
+
await _API.Session.UserSystem.Manage.RemoveUser(_User).ConfigureAwait(false);
Device.BeginInvokeOnMainThread(async () =>
diff --git a/Borepin/Borepin/Resources/Text/TextResource.Designer.cs b/Borepin/Borepin/Resources/Text/TextResource.Designer.cs
index da755b4..6aadf32 100644
--- a/Borepin/Borepin/Resources/Text/TextResource.Designer.cs
+++ b/Borepin/Borepin/Resources/Text/TextResource.Designer.cs
@@ -159,6 +159,15 @@ namespace Borepin.Resources.Text {
}
}
+ ///
+ /// Looks up a localized string similar to Add User failed.
+ ///
+ internal static string ALERT_AddUserFailed {
+ get {
+ return ResourceManager.GetString("ALERT_AddUserFailed", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Unable to authenticate to server..
///
@@ -177,6 +186,15 @@ namespace Borepin.Resources.Text {
}
}
+ ///
+ /// Looks up a localized string similar to Password is invalid..
+ ///
+ internal static string ALERT_PasswordInvalid {
+ get {
+ return ResourceManager.GetString("ALERT_PasswordInvalid", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to QR Code is invalid.
///
@@ -204,6 +222,24 @@ namespace Borepin.Resources.Text {
}
}
+ ///
+ /// Looks up a localized string similar to User allready exist..
+ ///
+ internal static string ALERT_UserExist {
+ get {
+ return ResourceManager.GetString("ALERT_UserExist", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Username is invalid..
+ ///
+ internal static string ALERT_UsernameInvalid {
+ get {
+ return ResourceManager.GetString("ALERT_UsernameInvalid", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to It's Bionade.
///
diff --git a/Borepin/Borepin/Resources/Text/TextResource.resx b/Borepin/Borepin/Resources/Text/TextResource.resx
index 43c56f6..9d421f1 100644
--- a/Borepin/Borepin/Resources/Text/TextResource.resx
+++ b/Borepin/Borepin/Resources/Text/TextResource.resx
@@ -151,12 +151,18 @@
Server address is invaild.
+
+ Add User failed
+
Unable to authenticate to server.
Connection failed
+
+ Password is invalid.
+
QR Code is invalid
@@ -166,6 +172,12 @@
Unexpected Error.
+
+ User allready exist.
+
+
+ Username is invalid.
+
It's Bionade
diff --git a/Borepin/Borepin/ViewModel/PermissionSelectViewModel.cs b/Borepin/Borepin/ViewModel/PermissionSelectViewModel.cs
index 71de261..bc9b452 100644
--- a/Borepin/Borepin/ViewModel/PermissionSelectViewModel.cs
+++ b/Borepin/Borepin/ViewModel/PermissionSelectViewModel.cs
@@ -12,7 +12,7 @@ using System.Windows.Input;
namespace Borepin.ViewModel
{
- public class PermissionSelectViewModel : ConnectionModelBase
+ public class PermissionSelectViewModel : ConnectionModelBase, IDisposable
{
#region Private Fields
private User _User;
@@ -91,21 +91,21 @@ namespace Borepin.ViewModel
return;
}
- if(_API.IsConnected)
+ if(_API.IsConnected && _User != null)
{
try
{
List user_role_list = new List(await _User.Info.ListRoles().ConfigureAwait(false));
if(IsChecked)
{
- if(!user_role_list.Contains(_Role))
+ if(!user_role_list.Exists(x => string.Equals(x.Name, _Role.Name, StringComparison.Ordinal)))
{
await _User.Admin.AddRole(_Role).ConfigureAwait(false);
}
}
else
{
- if(user_role_list.Contains(_Role))
+ if(user_role_list.Exists(x => string.Equals(x.Name, _Role.Name, StringComparison.Ordinal)))
{
await _User.Admin.RemoveRole(_Role).ConfigureAwait(false);
}
@@ -116,6 +116,12 @@ namespace Borepin.ViewModel
Log.Debug("RPC Connection Loss");
}
}
+ }
+
+ public void Dispose()
+ {
+ _User = null;
+ _Role = null;
}
#endregion
}