Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cdy816
Mars
提交
8fc23fe6
Mars
项目概览
cdy816
/
Mars
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8fc23fe6
编写于
6月 21, 2020
作者:
cdy816
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
变量开发环境Bug修改
上级
c723ad9d
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
206 addition
and
391 deletion
+206
-391
Common/Cdy.Tag.Common/Common/Md5Helper.cs
Common/Cdy.Tag.Common/Common/Md5Helper.cs
+2
-2
Develop/DBDevelopService/GrpcDBService.cs
Develop/DBDevelopService/GrpcDBService.cs
+1
-0
Develop/DBDevelopService/Program.cs
Develop/DBDevelopService/Program.cs
+0
-28
Develop/DBDevelopService/Security/Permission.cs
Develop/DBDevelopService/Security/Permission.cs
+0
-42
Develop/DBDevelopService/Security/PermissionDocument.cs
Develop/DBDevelopService/Security/PermissionDocument.cs
+0
-72
Develop/DBDevelopService/Security/Security.cs
Develop/DBDevelopService/Security/Security.cs
+0
-5
Develop/DBDevelopService/Security/SecurityManager.cs
Develop/DBDevelopService/Security/SecurityManager.cs
+9
-0
Develop/DBDevelopService/Security/SecuritySerise.cs
Develop/DBDevelopService/Security/SecuritySerise.cs
+81
-56
Develop/DBDevelopService/Security/UserDocument.cs
Develop/DBDevelopService/Security/UserDocument.cs
+2
-0
Develop/DBDevelopService/Security/UserDocumentSerise.cs
Develop/DBDevelopService/Security/UserDocumentSerise.cs
+0
-130
Develop/DBDevelopService/Services/DevelopServerService.cs
Develop/DBDevelopService/Services/DevelopServerService.cs
+19
-19
Develop/DBDevelopService/Startup.cs
Develop/DBDevelopService/Startup.cs
+1
-1
Develop/DBStudio/Program.cs
Develop/DBStudio/Program.cs
+50
-29
Develop/DBStudio/Properties/Resources.Designer.cs
Develop/DBStudio/Properties/Resources.Designer.cs
+9
-0
Develop/DBStudio/Properties/Resources.resx
Develop/DBStudio/Properties/Resources.resx
+3
-0
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
+4
-0
Develop/DbManager.Desktop/Image/cancel.png
Develop/DbManager.Desktop/Image/cancel.png
+0
-0
Develop/DbManager.Desktop/Image/ok.png
Develop/DbManager.Desktop/Image/ok.png
+0
-0
Develop/DbManager.Desktop/Themes/Generic.xaml
Develop/DbManager.Desktop/Themes/Generic.xaml
+20
-2
Develop/DbManager.Desktop/View/ListDatabaseView.xaml
Develop/DbManager.Desktop/View/ListDatabaseView.xaml
+1
-1
Develop/DbManager.Desktop/View/LoginView.xaml
Develop/DbManager.Desktop/View/LoginView.xaml
+2
-2
Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs
Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs
+1
-1
Develop/DbManager.Desktop/ViewModel/Server/ServerUserManagerViewModel.cs
...er.Desktop/ViewModel/Server/ServerUserManagerViewModel.cs
+1
-1
未找到文件。
Common/Cdy.Tag.Common/Common/Md5Helper.cs
浏览文件 @
8fc23fe6
...
...
@@ -20,7 +20,7 @@ namespace Cdy.Tag.Common.Common
public
static
string
Encode
(
string
data
)
{
return
Encode
(
data
,
"mrdb"
,
"20200619"
);
return
Encode
(
data
,
"mrdb
cdy0
"
,
"20200619"
);
}
/// <summary>
...
...
@@ -63,7 +63,7 @@ namespace Cdy.Tag.Common.Common
/// <returns></returns>
public
static
string
Decode
(
string
data
)
{
return
Decode
(
data
,
"mrdb"
,
"20200619"
);
return
Decode
(
data
,
"mrdb
cdy0
"
,
"20200619"
);
}
/// <summary>
...
...
Develop/DBDevelopService/GrpcDBService.cs
浏览文件 @
8fc23fe6
...
...
@@ -70,6 +70,7 @@ namespace DBDevelopService
}
sip
+=
":"
+
port
;
mhost
=
CreateHostBuilder
(
sip
).
Build
();
LoggerService
.
Service
.
Info
(
"DBService"
,
"启动服务:"
+
sip
);
await
mhost
.
StartAsync
();
}
...
...
Develop/DBDevelopService/Program.cs
已删除
100644 → 0
浏览文件 @
c723ad9d
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Hosting
;
namespace
DBDevelopService
{
public
class
Program
{
public
static
void
Main
(
string
[]
args
)
{
CreateHostBuilder
(
args
).
Build
().
Run
();
}
// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
=>
Host
.
CreateDefaultBuilder
(
args
)
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
webBuilder
.
UseStartup
<
Startup
>();
});
}
}
Develop/DBDevelopService/Security/Permission.cs
已删除
100644 → 0
浏览文件 @
c723ad9d
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
DBDevelopService
{
public
class
Permission
{
#
region
...
Variables
...
#
endregion
...
Variables
...
#
region
...
Events
...
#
endregion
...
Events
...
#
region
...
Constructor
...
#
endregion
...
Constructor
...
#
region
...
Properties
...
public
string
Name
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
bool
IsAdmin
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
#
endregion
...
Methods
...
#
region
...
Interfaces
...
#
endregion
...
Interfaces
...
}
}
Develop/DBDevelopService/Security/PermissionDocument.cs
已删除
100644 → 0
浏览文件 @
c723ad9d
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
DBDevelopService
{
/// <summary>
///
/// </summary>
public
class
PermissionDocument
{
#
region
...
Variables
...
public
const
string
NewPermission
=
"new"
;
public
const
string
DeletePermission
=
"delete"
;
public
const
string
ModifyPermission
=
"modify"
;
public
const
string
AdminPermission
=
"admin"
;
private
Dictionary
<
string
,
Permission
>
mPermissions
=
new
Dictionary
<
string
,
Permission
>();
#
endregion
...
Variables
...
#
region
...
Events
...
#
endregion
...
Events
...
#
region
...
Constructor
...
/// <summary>
///
/// </summary>
public
PermissionDocument
()
{
InitInnerPermission
();
}
#
endregion
...
Constructor
...
#
region
...
Properties
...
/// <summary>
///
/// </summary>
public
Dictionary
<
string
,
Permission
>
Permissions
{
get
{
return
mPermissions
;
}
}
#
endregion
...
Properties
...
#
region
...
Methods
...
/// <summary>
///
/// </summary>
private
void
InitInnerPermission
()
{
mPermissions
.
Add
(
NewPermission
,
new
Permission
()
{
Name
=
NewPermission
});
mPermissions
.
Add
(
DeletePermission
,
new
Permission
()
{
Name
=
DeletePermission
});
//mPermissions.Add(ModifyPermission, new Permission() { Name = ModifyPermission });
mPermissions
.
Add
(
AdminPermission
,
new
Permission
()
{
Name
=
AdminPermission
,
IsAdmin
=
true
});
}
#
endregion
...
Methods
...
#
region
...
Interfaces
...
#
endregion
...
Interfaces
...
}
}
Develop/DBDevelopService/Security/Security.cs
浏览文件 @
8fc23fe6
...
...
@@ -35,11 +35,6 @@ namespace DBDevelopService.Security
/// </summary>
public
UserDocument
User
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
PermissionDocument
Permission
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
...
...
Develop/DBDevelopService/Security/SecurityManager.cs
浏览文件 @
8fc23fe6
...
...
@@ -59,6 +59,15 @@ namespace DBDevelopService
this
.
Securitys
=
ss
.
Document
;
}
/// <summary>
///
/// </summary>
public
void
Save
()
{
Security
.
SecuritySerise
ss
=
new
Security
.
SecuritySerise
()
{
Document
=
this
.
Securitys
};
ss
.
Save
();
}
/// <summary>
///
/// </summary>
...
...
Develop/DBDevelopService/Security/SecuritySerise.cs
浏览文件 @
8fc23fe6
using
System
;
using
Cdy.Tag.Common.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Xml.Linq
;
...
...
@@ -32,72 +34,86 @@ namespace DBDevelopService.Security
/// </summary>
public
void
Save
()
{
string
sfile
=
System
.
IO
.
Path
.
Combine
(
System
.
IO
.
Path
.
GetDirectoryName
(
this
.
GetType
().
Assembly
.
Location
),
"Sec.sdb"
);
System
.
IO
.
File
.
WriteAllText
(
sfile
,
Md5Helper
.
Encode
(
SaveToXML
().
ToString
()));
}
/// <summary>
///
/// </summary>
/// <param name="file"></param>
public
void
Save
(
string
file
)
public
XElement
SaveToXML
(
)
{
XElement
doc
=
new
XElement
(
"Security"
);
doc
.
SetAttributeValue
(
"Version"
,
this
.
Document
.
Version
);
doc
.
SetAttributeValue
(
"Auther"
,
"cdy"
);
doc
.
Add
(
Save
(
this
.
Document
.
User
));
doc
.
Add
(
Save
(
this
.
Document
.
Permission
));
doc
.
Save
(
file
);
return
doc
;
}
/// <summary>
///
/// </summary>
public
void
Load
()
/// <param name="user"></param>
/// <returns></returns>
private
XElement
Save
(
UserDocument
user
)
{
string
sfile
=
System
.
IO
.
Path
.
Combine
(
System
.
IO
.
Path
.
GetDirectoryName
(
this
.
GetType
().
Assembly
.
Location
),
"User.dat"
);
Load
(
sfile
);
}
XElement
xe
=
new
XElement
(
"Users"
);
/// <summary>
///
/// </summary>
/// <param name="file"></param>
public
void
Load
(
string
file
)
{
Security
db
=
new
Security
();
if
(
System
.
IO
.
File
.
Exists
(
file
))
foreach
(
var
vv
in
user
.
Users
)
{
XElement
xe
=
XElement
.
Load
(
file
);
db
.
Version
=
xe
.
Attribute
(
"Version"
).
Value
;
if
(
xe
.
Element
(
"User"
)
!=
null
)
XElement
xx
=
new
XElement
(
"User"
);
xx
.
SetAttributeValue
(
"Name"
,
vv
.
Value
.
Name
);
xx
.
SetAttributeValue
(
"Password"
,
vv
.
Value
.
Password
);
xx
.
SetAttributeValue
(
"NewDatabase"
,
vv
.
Value
.
NewDatabase
);
xx
.
SetAttributeValue
(
"DeleteDatabase"
,
vv
.
Value
.
DeleteDatabase
);
xx
.
SetAttributeValue
(
"IsAdmin"
,
vv
.
Value
.
IsAdmin
);
if
(
vv
.
Value
.
Databases
!=
null
&&
vv
.
Value
.
Databases
.
Count
>
0
)
{
db
.
User
=
LoadUser
(
xe
.
Element
(
"User"
));
StringBuilder
sb
=
new
StringBuilder
();
foreach
(
var
vvv
in
vv
.
Value
.
Databases
)
{
sb
.
Append
(
vvv
+
","
);
}
sb
.
Length
=
sb
.
Length
>
0
?
sb
.
Length
-
1
:
sb
.
Length
;
xx
.
SetAttributeValue
(
"Database"
,
sb
.
ToString
());
}
xe
.
Add
(
xx
);
}
return
xe
;
}
if
(
xe
.
Element
(
"Permissions"
)
!=
null
)
{
db
.
Permission
=
LoadPermission
(
xe
.
Element
(
"Permissions"
));
}
public
void
Load
()
{
string
sfile
=
System
.
IO
.
Path
.
Combine
(
System
.
IO
.
Path
.
GetDirectoryName
(
this
.
GetType
().
Assembly
.
Location
),
"Sec.sdb"
);
if
(
System
.
IO
.
File
.
Exists
(
sfile
))
{
var
txt
=
Md5Helper
.
Decode
(
System
.
IO
.
File
.
ReadAllText
(
sfile
));
this
.
Document
=
LoadFromXML
(
XElement
.
Parse
(
txt
));
}
else
{
db
.
Permission
=
new
PermissionDocument
();
Security
db
=
new
Security
();
db
.
User
=
new
UserDocument
();
db
.
User
.
AddDefaultUser
();
this
.
Document
=
db
;
}
this
.
Document
=
db
;
}
/// <summary>
///
/// </summary>
/// <param name="
element
"></param>
/// <param name="
xe
"></param>
/// <returns></returns>
public
UserDocument
LoadUser
(
XElement
element
)
public
Security
LoadFromXML
(
XElement
xe
)
{
return
null
;
Security
db
=
new
Security
();
db
.
Version
=
xe
.
Attribute
(
"Version"
).
Value
;
if
(
xe
.
Element
(
"Users"
)
!=
null
)
{
db
.
User
=
LoadUser
(
xe
.
Element
(
"Users"
));
}
return
db
;
}
/// <summary>
...
...
@@ -105,32 +121,41 @@ namespace DBDevelopService.Security
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
public
PermissionDocument
LoadPermission
(
XElement
element
)
{
return
null
;
}
/// <summary>
///
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
private
XElement
Save
(
UserDocument
user
)
public
UserDocument
LoadUser
(
XElement
xe
)
{
XElement
xe
=
new
XElement
(
"User"
);
return
xe
;
}
var
Document
=
new
UserDocument
();
foreach
(
var
vv
in
xe
.
Elements
())
{
User
user
=
new
User
();
if
(
vv
.
Attribute
(
"Name"
)
!=
null
)
{
user
.
Name
=
vv
.
Attribute
(
"Name"
).
Value
;
}
if
(
vv
.
Attribute
(
"Password"
)
!=
null
)
{
user
.
Password
=
vv
.
Attribute
(
"Password"
).
Value
;
}
if
(
vv
.
Attribute
(
"NewDatabase"
)
!=
null
)
{
user
.
NewDatabase
=
bool
.
Parse
(
vv
.
Attribute
(
"NewDatabase"
).
Value
);
}
if
(
vv
.
Attribute
(
"DeleteDatabase"
)
!=
null
)
{
user
.
DeleteDatabase
=
bool
.
Parse
(
vv
.
Attribute
(
"DeleteDatabase"
).
Value
);
}
if
(
vv
.
Attribute
(
"IsAdmin"
)
!=
null
)
{
user
.
IsAdmin
=
bool
.
Parse
(
vv
.
Attribute
(
"IsAdmin"
).
Value
);
}
/// <summary>
///
/// </summary>
/// <param name="permission"></param>
/// <returns></returns>
private
XElement
Save
(
PermissionDocument
permission
)
{
XElement
xe
=
new
XElement
(
"Permission"
);
return
xe
;
if
(
vv
.
Attribute
(
"Database"
)
!=
null
)
{
string
sval
=
vv
.
Attribute
(
"Database"
).
Value
;
user
.
Databases
.
AddRange
(
sval
.
Split
(
new
char
[]
{
','
}));
}
Document
.
AddUser
(
user
);
}
return
Document
;
}
...
...
Develop/DBDevelopService/Security/UserDocument.cs
浏览文件 @
8fc23fe6
...
...
@@ -40,6 +40,8 @@ namespace DBDevelopService
}
}
#
endregion
...
Properties
...
#
region
...
Methods
...
...
...
Develop/DBDevelopService/Security/UserDocumentSerise.cs
已删除
100644 → 0
浏览文件 @
c723ad9d
using
Cdy.Tag.Common.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Xml.Linq
;
namespace
DBDevelopService.Security
{
public
class
UserDocumentSerise
{
#
region
...
Variables
...
#
endregion
...
Variables
...
#
region
...
Events
...
#
endregion
...
Events
...
#
region
...
Constructor
...
#
endregion
...
Constructor
...
#
region
...
Properties
...
/// <summary>
///
/// </summary>
public
UserDocument
Document
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
/// <summary>
///
/// </summary>
public
void
Save
()
{
string
sfile
=
System
.
IO
.
Path
.
Combine
(
System
.
IO
.
Path
.
GetDirectoryName
(
this
.
GetType
().
Assembly
.
Location
),
"Sec.sdb"
);
System
.
IO
.
File
.
WriteAllText
(
sfile
,
Md5Helper
.
Encode
(
SaveToXML
().
ToString
()));
}
private
XElement
SaveToXML
()
{
XElement
xe
=
new
XElement
(
"UserDoc"
);
xe
.
SetAttributeValue
(
"Version"
,
Document
.
Version
);
foreach
(
var
vv
in
Document
.
Users
)
{
XElement
xx
=
new
XElement
(
"User"
);
xx
.
SetAttributeValue
(
"Name"
,
vv
.
Value
.
Name
);
xx
.
SetAttributeValue
(
"Password"
,
vv
.
Value
.
Password
);
xx
.
SetAttributeValue
(
"NewDatabase"
,
vv
.
Value
.
NewDatabase
);
xx
.
SetAttributeValue
(
"DeleteDatabase"
,
vv
.
Value
.
DeleteDatabase
);
xx
.
SetAttributeValue
(
"IsAdmin"
,
vv
.
Value
.
IsAdmin
);
if
(
vv
.
Value
.
Databases
!=
null
&&
vv
.
Value
.
Databases
.
Count
>
0
)
{
StringBuilder
sb
=
new
StringBuilder
();
foreach
(
var
vvv
in
vv
.
Value
.
Databases
)
{
sb
.
Append
(
vvv
+
","
);
}
sb
.
Length
=
sb
.
Length
>
0
?
sb
.
Length
-
1
:
sb
.
Length
;
xx
.
SetAttributeValue
(
"Database"
,
sb
.
ToString
());
}
xe
.
Add
(
xx
);
}
return
xe
;
}
/// <summary>
///
/// </summary>
public
void
Load
()
{
string
sfile
=
System
.
IO
.
Path
.
Combine
(
System
.
IO
.
Path
.
GetDirectoryName
(
this
.
GetType
().
Assembly
.
Location
),
"Sec.sdb"
);
var
txt
=
System
.
IO
.
File
.
ReadAllText
(
sfile
);
LoadFromXML
(
XElement
.
Parse
(
txt
));
}
public
void
LoadFromXML
(
XElement
xe
)
{
Document
=
new
UserDocument
();
if
(
xe
.
Attribute
(
"Version"
)
!=
null
)
{
Document
.
Version
=
xe
.
Attribute
(
"Version"
).
Value
;
}
foreach
(
var
vv
in
xe
.
Elements
())
{
User
user
=
new
User
();
if
(
vv
.
Attribute
(
"Name"
)
!=
null
)
{
user
.
Name
=
vv
.
Attribute
(
"Name"
).
Value
;
}
if
(
vv
.
Attribute
(
"Password"
)
!=
null
)
{
user
.
Password
=
vv
.
Attribute
(
"Password"
).
Value
;
}
if
(
vv
.
Attribute
(
"NewDatabase"
)
!=
null
)
{
user
.
NewDatabase
=
bool
.
Parse
(
vv
.
Attribute
(
"NewDatabase"
).
Value
);
}
if
(
vv
.
Attribute
(
"DeleteDatabase"
)
!=
null
)
{
user
.
DeleteDatabase
=
bool
.
Parse
(
vv
.
Attribute
(
"DeleteDatabase"
).
Value
);
}
if
(
vv
.
Attribute
(
"IsAdmin"
)
!=
null
)
{
user
.
IsAdmin
=
bool
.
Parse
(
vv
.
Attribute
(
"IsAdmin"
).
Value
);
}
if
(
vv
.
Attribute
(
"Database"
)
!=
null
)
{
string
sval
=
vv
.
Attribute
(
"Database"
).
Value
;
user
.
Databases
.
AddRange
(
sval
.
Split
(
new
char
[]
{
','
}));
}
}
}
#
endregion
...
Methods
...
#
region
...
Interfaces
...
#
endregion
...
Interfaces
...
}
}
Develop/DBDevelopService/Services/DevelopServerService.cs
浏览文件 @
8fc23fe6
...
...
@@ -501,6 +501,7 @@ namespace DBDevelopService
}
var
user
=
new
User
()
{
Name
=
request
.
UserName
,
Password
=
request
.
Password
};
SecurityManager
.
Manager
.
Securitys
.
User
.
AddUser
(
user
);
SecurityManager
.
Manager
.
Save
();
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
true
});
}
...
...
@@ -518,6 +519,7 @@ namespace DBDevelopService
}
bool
re
=
SecurityManager
.
Manager
.
Securitys
.
User
.
RenameUser
(
request
.
OldName
,
request
.
NewName
);
SecurityManager
.
Manager
.
RenameLoginUser
(
request
.
OldName
,
request
.
NewName
);
SecurityManager
.
Manager
.
Save
();
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
re
});
}
...
...
@@ -535,9 +537,11 @@ namespace DBDevelopService
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
});
}
var
user
=
SecurityManager
.
Manager
.
Securitys
.
User
.
GetUser
(
request
.
UserName
);
if
(
user
!=
null
)
user
.
Password
=
request
.
Newpassword
;
if
(
user
!=
null
)
{
user
.
Password
=
request
.
Newpassword
;
SecurityManager
.
Manager
.
Save
();
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
true
});
}
...
...
@@ -554,6 +558,14 @@ namespace DBDevelopService
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
});
}
var
user
=
SecurityManager
.
Manager
.
Securitys
.
User
.
GetUser
(
request
.
UserName
);
if
(
user
!=
null
)
{
user
.
IsAdmin
=
request
.
IsAdmin
;
user
.
NewDatabase
=
request
.
NewDatabasePermission
;
user
.
Databases
=
request
.
Database
.
ToList
();
SecurityManager
.
Manager
.
Save
();
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
true
});
}
...
...
@@ -573,7 +585,9 @@ namespace DBDevelopService
if
(
user
!=
null
)
{
user
.
Password
=
request
.
Password
;
SecurityManager
.
Manager
.
Save
();
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
true
});
}
...
...
@@ -617,26 +631,12 @@ namespace DBDevelopService
if
(
user
!=
null
)
{
SecurityManager
.
Manager
.
Securitys
.
User
.
RemoveUser
(
request
.
UserName
);
SecurityManager
.
Manager
.
Save
();
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
true
});
}
///// <summary>
/////
///// </summary>
///// <param name="request"></param>
///// <param name="context"></param>
///// <returns></returns>
//public override Task<GetPermissionsReplay> GetPermissions(GetRequest request, ServerCallContext context)
//{
// if (!IsAdmin(request.LoginId))
// {
// return Task.FromResult(new GetPermissionsReplay() { Result = false });
// }
// GetPermissionsReplay replay = new GetPermissionsReplay() { Result = true };
// replay.Permission.AddRange(SecurityManager.Manager.Securitys.Permission.Permissions.Keys.ToList());
// return Task.FromResult(replay);
//}
#
endregion
...
...
Develop/DBDevelopService/Startup.cs
浏览文件 @
8fc23fe6
...
...
@@ -30,7 +30,7 @@ namespace DBDevelopService
}
app
.
UseRouting
();
app
.
UseEndpoints
(
endpoints
=>
{
...
...
Develop/DBStudio/Program.cs
浏览文件 @
8fc23fe6
...
...
@@ -13,6 +13,7 @@ namespace DBStudio
{
class
Program
{
static
bool
mIsExited
=
false
;
static
void
Main
(
string
[]
args
)
{
int
port
=
5001
;
...
...
@@ -27,49 +28,69 @@ namespace DBStudio
webPort
=
int
.
Parse
(
args
[
1
]);
}
WindowConsolHelper
.
DisbleQuickEditMode
();
Console
.
CancelKeyPress
+=
Console_CancelKeyPress
;
LogoHelper
.
Print
();
DBDevelopService
.
Service
.
Instanse
.
Start
(
port
,
webPort
);
//OutByLine("", "输入exit退出服务");
OutByLine
(
""
,
Res
.
Get
(
"HelpMsg"
));
while
(
true
)
while
(
!
mIsExited
)
{
OutInLine
(
""
,
""
);
string
[]
cmd
=
Console
.
ReadLine
().
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
cmd
.
Length
==
0
)
continue
;
string
cmsg
=
cmd
[
0
].
ToLower
();
if
(
cmsg
==
"exit"
)
var
vv
=
Console
.
ReadLine
();
if
(
vv
!=
null
)
{
OutByLine
(
""
,
"确定要退出?输入y确定,输入其他任意字符取消"
);
cmd
=
Console
.
ReadLine
().
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
string
[]
cmd
=
vv
.
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
cmd
.
Length
==
0
)
continue
;
if
(
cmd
[
0
].
ToLower
()
==
"y"
)
break
;
}
else
if
(
cmsg
==
"db"
)
{
if
(
cmd
.
Length
>
1
)
ProcessDatabaseCreate
(
cmd
[
1
]);
}
else
if
(
cmsg
==
"list"
)
{
ListDatabase
();
}
else
if
(
cmsg
==
"h"
)
{
OutByLine
(
""
,
GetHelpString
());
}
else
if
(
cmsg
==
"**"
)
{
LogoHelper
.
PrintAuthor
();
string
cmsg
=
cmd
[
0
].
ToLower
();
if
(
cmsg
==
"exit"
)
{
OutByLine
(
""
,
"确定要退出?输入y确定,输入其他任意字符取消"
);
cmd
=
Console
.
ReadLine
().
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
cmd
.
Length
==
0
)
continue
;
if
(
cmd
[
0
].
ToLower
()
==
"y"
)
break
;
}
else
if
(
cmsg
==
"db"
)
{
if
(
cmd
.
Length
>
1
)
ProcessDatabaseCreate
(
cmd
[
1
]);
}
else
if
(
cmsg
==
"list"
)
{
ListDatabase
();
}
else
if
(
cmsg
==
"h"
)
{
OutByLine
(
""
,
GetHelpString
());
}
else
if
(
cmsg
==
"**"
)
{
LogoHelper
.
PrintAuthor
();
}
}
}
DBDevelopService
.
Service
.
Instanse
.
Stop
();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
static
void
Console_CancelKeyPress
(
object
sender
,
ConsoleCancelEventArgs
e
)
{
mIsExited
=
true
;
e
.
Cancel
=
true
;
Console
.
ForegroundColor
=
ConsoleColor
.
Yellow
;
Console
.
WriteLine
(
Res
.
Get
(
"AnyKeyToExit"
));
Console
.
ResetColor
();
}
/// <summary>
///
...
...
Develop/DBStudio/Properties/Resources.Designer.cs
浏览文件 @
8fc23fe6
...
...
@@ -60,6 +60,15 @@ namespace DBInStudioServer.Properties {
}
}
/// <summary>
/// 查找类似 press 'enter' to exit. 的本地化字符串。
/// </summary>
internal
static
string
AnyKeyToExit
{
get
{
return
ResourceManager
.
GetString
(
"AnyKeyToExit"
,
resourceCulture
);
}
}
/// <summary>
/// 查找类似 Invailed Parameter! 的本地化字符串。
/// </summary>
...
...
Develop/DBStudio/Properties/Resources.resx
浏览文件 @
8fc23fe6
...
...
@@ -117,6 +117,9 @@
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data
name=
"AnyKeyToExit"
xml:space=
"preserve"
>
<value>
press 'enter' to exit.
</value>
</data>
<data
name=
"ErroParameter"
xml:space=
"preserve"
>
<value>
Invailed Parameter!
</value>
</data>
...
...
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
浏览文件 @
8fc23fe6
...
...
@@ -17,6 +17,7 @@
<ItemGroup>
<None Remove="Image\add.png" />
<None Remove="Image\cancel.png" />
<None Remove="Image\database-add.png" />
<None Remove="Image\export.png" />
<None Remove="Image\export2.png" />
...
...
@@ -25,6 +26,7 @@
<None Remove="Image\import2.png" />
<None Remove="Image\log-out.png" />
<None Remove="Image\mrdbd.ico" />
<None Remove="Image\ok.png" />
<None Remove="Image\permissions.png" />
<None Remove="Image\remove.png" />
<None Remove="Image\save.png" />
...
...
@@ -46,6 +48,7 @@
<ItemGroup>
<Resource Include="Image\add.png" />
<Resource Include="Image\cancel.png" />
<Resource Include="Image\database-add.png" />
<Resource Include="Image\export.png" />
<Resource Include="Image\export2.png" />
...
...
@@ -54,6 +57,7 @@
<Resource Include="Image\import2.png" />
<Resource Include="Image\log-out.png" />
<Resource Include="Image\mrdbd.ico" />
<Resource Include="Image\ok.png" />
<Resource Include="Image\permissions.png" />
<Resource Include="Image\remove.png" />
<Resource Include="Image\save.png" />
...
...
Develop/DbManager.Desktop/Image/cancel.png
0 → 100644
浏览文件 @
8fc23fe6
157 字节
Develop/DbManager.Desktop/Image/ok.png
0 → 100644
浏览文件 @
8fc23fe6
325 字节
Develop/DbManager.Desktop/Themes/Generic.xaml
浏览文件 @
8fc23fe6
...
...
@@ -83,8 +83,26 @@
<Border Height="30" Grid.Row="1" BorderBrush="DarkGray" BorderThickness="0,1,0,0" Visibility="{Binding IsOkCancel,Converter={StaticResource bvc}}">
<Grid Background="#FFF0F0F0" Margin="0" >
<Label Content="{Binding Message}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,200,0" />
<Button Name="btn_Cancel" Background="#FFF0F0F0" IsCancel="{Binding IsEnableDefault}" Content="{local:ResMarker Cancel}" Height="22" Width="75" Margin="0,0,10,0" Command="{Binding CancelCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" />
<Button Name="btn_OK" Background="#FFF0F0F0" IsDefault="{Binding IsEnableDefault}" Content="{local:ResMarker OK}" Height="22" Width="75" Margin="0,0,100,0" Command="{Binding OKCommand}" HorizontalAlignment="Right" />
<Button Name="btn_Cancel" Background="#FFF0F0F0" IsCancel="{Binding IsEnableDefault}" Content="{local:ResMarker Cancel}" Height="22" Width="75" Margin="0,0,10,0" Command="{Binding CancelCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" >
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/cancel.png" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
<TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<Button Name="btn_OK" Background="#FFF0F0F0" IsDefault="{Binding IsEnableDefault}" Content="{local:ResMarker OK}" Height="22" Width="75" Margin="0,0,100,0" Command="{Binding OKCommand}" HorizontalAlignment="Right" >
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/ok.png" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
<TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
</Grid>
</Border>
</Grid>
...
...
Develop/DbManager.Desktop/View/ListDatabaseView.xaml
浏览文件 @
8fc23fe6
...
...
@@ -77,7 +77,7 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Margin="10,0" Text="{res:ResMarker SelectDatabase}" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ListBox ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}" Margin="-1" Grid.Row="1" ItemsSource="{Binding DatabaseItems}" SelectedItem="{Binding SelectDatabase,Mode=TwoWay}">
<ListBox ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}" Margin="-1" Grid.Row="1"
BorderThickness="0"
ItemsSource="{Binding DatabaseItems}" SelectedItem="{Binding SelectDatabase,Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid MinHeight="28">
...
...
Develop/DbManager.Desktop/View/LoginView.xaml
浏览文件 @
8fc23fe6
...
...
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:DBInStudio.Desktop.View"
xmlns:res="clr-namespace:DBInStudio.Desktop"
mc:Ignorable="d"
d:DesignHeight="180" d:DesignWidth="500">
d:DesignHeight="180" d:DesignWidth="500"
UseLayoutRounding="True" SnapsToDevicePixels="True"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
...
...
@@ -20,7 +20,7 @@
<Label Content="{res:ResMarker ServerIp,:}" HorizontalAlignment="Center" Margin="10,0" VerticalAlignment="Center"/>
<Label Content="{res:ResMarker UserName,:}" HorizontalAlignment="Center" Margin="10,0" VerticalAlignment="Center" Grid.Row="1"/>
<Label Content="{res:ResMarker Password,:}" HorizontalAlignment="Center" Margin="10,0" VerticalAlignment="Center" Grid.Row="2"/>
<ComboBox
VerticalContentAlignment="Center"
Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Text="{Binding Server}" Width="300" Height="32" IsEditable="True" />
<ComboBox
UseLayoutRounding="True" VerticalContentAlignment="Center"
Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Text="{Binding Server}" Width="300" Height="32" IsEditable="True" />
<TextBox VerticalContentAlignment="Center" Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="1" Text="{Binding UserName}" Height="32" TextWrapping="Wrap" VerticalAlignment="Center" Width="300"/>
<PasswordBox VerticalContentAlignment="Center" x:Name="pb" PasswordChanged="PasswordBox_PasswordChanged" Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="2" Height="32" VerticalAlignment="Center" Width="300"/>
...
...
Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs
浏览文件 @
8fc23fe6
...
...
@@ -25,7 +25,7 @@ namespace DBInStudio.Desktop.ViewModel
#
region
...
Variables
...
private
string
mServer
=
"127.0.0.1"
;
private
string
mUserName
;
private
string
mPassword
;
private
string
mPassword
=
""
;
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
Develop/DbManager.Desktop/ViewModel/Server/ServerUserManagerViewModel.cs
浏览文件 @
8fc23fe6
...
...
@@ -241,7 +241,6 @@ namespace DBInStudio.Desktop.ViewModel
foreach
(
var
vv
in
users
)
{
var
uu
=
new
ServerUserItemViewModel
(
vv
.
Key
)
{
ParentModel
=
this
,
Database
=
vv
.
Value
.
Item3
,
IsAdmin
=
vv
.
Value
.
Item1
,
CanNewDatabase
=
vv
.
Value
.
Item2
};
uu
.
IsChanged
=
false
;
utmp
.
Add
(
uu
);
}
}
...
...
@@ -253,6 +252,7 @@ namespace DBInStudio.Desktop.ViewModel
foreach
(
var
vv
in
Users
)
{
vv
.
IntDatabase
(
mPermissionCach
);
vv
.
IsChanged
=
false
;
}
if
(
Users
.
Count
>
0
)
CurrentSelectedUser
=
Users
[
0
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录