Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
36c8aed5
Commit
36c8aed5
authored
Feb 24, 2023
by
ryun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建账号设置默认角色
parent
1041a2bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
performance/Performance.Services/OAuthService.cs
+7
-4
No files found.
performance/Performance.Services/OAuthService.cs
View file @
36c8aed5
...
...
@@ -173,13 +173,16 @@ public class OAuthService : IAutoInjection
public
UserIdentity
GetOrInitUserInfo
(
OAuthUserInfoResponse
userData
)
{
var
userId
=
0
;
var
user
=
_userRepository
.
GetEntity
(
w
=>
w
.
Login
==
userData
.
name
);
var
user
=
_userRepository
.
GetEntity
(
w
=>
w
.
Login
==
userData
.
desc
);
if
(
user
!=
null
)
{
userId
=
user
.
ID
;
}
else
{
var
roleid
=
_configuration
.
GetValue
(
"oauth2:default_roleid"
,
$"
{(
int
)
Role
.
绩效查询
}
"
);
var
roleIds
=
Array
.
ConvertAll
(
roleid
.
Split
(
","
,
StringSplitOptions
.
RemoveEmptyEntries
),
item
=>
int
.
Parse
(
item
));
var
mail
=
_configuration
.
GetValue
(
"oauth2:default_mail"
,
"{0}@oauth.com"
);
var
password
=
_configuration
.
GetValue
(
"oauth2:default_password"
,
"123456"
);
var
hosid
=
_configuration
.
GetValue
(
"oauth2:default_hosid"
,
0
);
...
...
@@ -188,15 +191,15 @@ public UserIdentity GetOrInitUserInfo(OAuthUserInfoResponse userData)
var
userRequest
=
new
UserRequest
{
Login
=
userData
.
name
+
Guid
.
NewGuid
().
ToString
(
"N"
)
,
Login
=
userData
.
desc
,
RealName
=
userData
.
name
,
Password
=
PwdHelper
.
MD5
(
password
),
HosIDArray
=
new
int
[]
{
hosid
},
RoleArr
=
new
int
[]
{
(
int
)
Role
.
绩效查询
}
,
RoleArr
=
roleIds
,
States
=
(
int
)
States
.
Enabled
,
Remark
=
JsonHelper
.
Serialize
(
userData
),
Department
=
""
,
Mail
=
string
.
Format
(
mail
,
userData
.
name
),
Mail
=
string
.
Format
(
mail
,
userData
.
desc
),
};
userId
=
_userService
.
InsertUser
(
userRequest
,
-
1001
).
UserID
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment