Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
蒋勇
zhichan
Commits
325f757a
Commit
325f757a
authored
Nov 12, 2019
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
7bf4c33d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
23 deletions
+49
-23
.vscode/launch.json
+15
-0
bigdata/app/base/controller/ctl.base.js
+10
-10
bigdata/app/base/controller/impl/auth/authCtl.js
+2
-2
bigdata/app/base/controller/impl/auth/userCtl.js
+14
-3
bigdata/app/base/controller/impl/common/metaCtl.js
+5
-5
bigdata/app/base/db/impl/auth/roleDao.js
+1
-1
bigdata/app/base/db/impl/auth/userDao.js
+1
-1
bigdata/app/base/db/impl/common/pconfigDao.js
+1
-1
No files found.
.vscode/launch.json
0 → 100644
View file @
325f757a
{
//
Use
IntelliSense
to
learn
about
possible
attributes.
//
Hover
to
view
descriptions
of
existing
attributes.
//
For
more
information
,
visit
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"type"
:
"node"
,
"request"
:
"launch"
,
"name"
:
"Launch Program"
,
"program"
:
"${workspaceFolder}/bigdata/main.js"
}
]
}
\ No newline at end of file
bigdata/app/base/controller/ctl.base.js
View file @
325f757a
...
@@ -47,9 +47,9 @@ class CtlBase {
...
@@ -47,9 +47,9 @@ class CtlBase {
async
refQuery
(
qobj
,
queryobj
,
req
)
{
async
refQuery
(
qobj
,
queryobj
,
req
)
{
if
(
qobj
.
refwhere
){
if
(
qobj
.
refwhere
){
qobj
.
refwhere
.
app_id
=
req
.
appid
;
qobj
.
refwhere
.
app_id
=
req
.
appid
;
qobj
.
refwhere
.
company_id
=
req
.
t
anent
id
;
qobj
.
refwhere
.
company_id
=
req
.
t
ocompany
id
;
}
else
{
}
else
{
qobj
.
refwhere
=
{
app_id
:
req
.
appid
,
company_id
:
req
.
t
anent
id
};
qobj
.
refwhere
=
{
app_id
:
req
.
appid
,
company_id
:
req
.
t
ocompany
id
};
}
}
var
rd
=
await
this
.
service
.
refQuery
(
qobj
);
var
rd
=
await
this
.
service
.
refQuery
(
qobj
);
...
@@ -74,8 +74,8 @@ class CtlBase {
...
@@ -74,8 +74,8 @@ class CtlBase {
}
}
}
}
if
(
req
&&
req
.
t
anent
id
)
{
//设置默认的公司id
if
(
req
&&
req
.
t
ocompany
id
)
{
//设置默认的公司id
qobj
.
company_id
=
req
.
t
anent
id
;
qobj
.
company_id
=
req
.
t
ocompany
id
;
// qobj.owner_id=req.tanentid;
// qobj.owner_id=req.tanentid;
}
}
var
rd
=
await
this
.
service
.
create
(
qobj
,
queryobj
,
req
);
var
rd
=
await
this
.
service
.
create
(
qobj
,
queryobj
,
req
);
...
@@ -158,15 +158,15 @@ class CtlBase {
...
@@ -158,15 +158,15 @@ class CtlBase {
//只要当前APP支持saas,并且非平台那么就设置
//只要当前APP支持saas,并且非平台那么就设置
if
(
req
.
session
.
app
&&
req
.
session
.
app
.
id
!=
settings
.
platformid
)
{
if
(
req
.
session
.
app
&&
req
.
session
.
app
.
id
!=
settings
.
platformid
)
{
if
(
req
.
session
.
app
.
isSaas
&&
tocompany
)
{
if
(
req
.
session
.
app
.
isSaas
&&
tocompany
)
{
req
.
t
anent
id
=
tocompany
.
id
;
req
.
t
ocompany
id
=
tocompany
.
id
;
pobj
.
t
anent
id
=
tocompany
.
id
;
pobj
.
t
ocompany
id
=
tocompany
.
id
;
}
else
{
}
else
{
req
.
t
anent
id
=
null
;
req
.
t
ocompany
id
=
null
;
pobj
.
t
anent
id
=
null
;
pobj
.
t
ocompany
id
=
null
;
}
}
}
else
{
}
else
{
req
.
t
anent
id
=
settings
.
platformcompanyid
;
req
.
t
ocompany
id
=
settings
.
platformcompanyid
;
pobj
.
t
anent
id
=
settings
.
platformcompanyid
;
pobj
.
t
ocompany
id
=
settings
.
platformcompanyid
;
}
}
}
}
...
...
bigdata/app/base/controller/impl/auth/authCtl.js
View file @
325f757a
...
@@ -10,12 +10,12 @@ class AuthCtl extends CtlBase{
...
@@ -10,12 +10,12 @@ class AuthCtl extends CtlBase{
}
}
async
saveAuths
(
qobj
,
query
,
req
){
async
saveAuths
(
qobj
,
query
,
req
){
var
auths
=
qobj
.
aus
;
var
auths
=
qobj
.
aus
;
var
xrtn
=
await
this
.
service
.
saveAuths
(
auths
,
req
.
appid
,
req
.
t
anent
id
);
var
xrtn
=
await
this
.
service
.
saveAuths
(
auths
,
req
.
appid
,
req
.
t
ocompany
id
);
return
system
.
getResult
(
xrtn
);
return
system
.
getResult
(
xrtn
);
}
}
async
findAuthsByRole
(
qobj
,
query
,
req
){
async
findAuthsByRole
(
qobj
,
query
,
req
){
var
rolecodestrs
=
qobj
.
rolecode
;
var
rolecodestrs
=
qobj
.
rolecode
;
var
xrtn
=
await
this
.
service
.
findAuthsByRole
(
rolecodestrs
,
req
.
appid
,
req
.
t
anent
id
);
var
xrtn
=
await
this
.
service
.
findAuthsByRole
(
rolecodestrs
,
req
.
appid
,
req
.
t
ocompany
id
);
return
system
.
getResult
(
xrtn
);
return
system
.
getResult
(
xrtn
);
}
}
}
}
...
...
bigdata/app/base/controller/impl/auth/userCtl.js
View file @
325f757a
...
@@ -119,7 +119,7 @@ class UserCtl extends CtlBase {
...
@@ -119,7 +119,7 @@ class UserCtl extends CtlBase {
fmuser
.
owner_id
=
settings
.
platformid
;
fmuser
.
owner_id
=
settings
.
platformid
;
}
else
{
//否则 todo
}
else
{
//否则 todo
if
(
!
fmuser
.
owner_id
&&
req
.
session
.
tocompany
){
if
(
!
fmuser
.
owner_id
&&
req
.
session
.
tocompany
){
fmuser
.
owner_id
=
req
.
t
anent
id
;
fmuser
.
owner_id
=
req
.
t
ocompany
id
;
}
}
}
}
var
ruser
=
await
this
.
service
.
register
(
fmuser
);
var
ruser
=
await
this
.
service
.
register
(
fmuser
);
...
@@ -143,7 +143,7 @@ class UserCtl extends CtlBase {
...
@@ -143,7 +143,7 @@ class UserCtl extends CtlBase {
//管理员新增用户,设置默认密码
//管理员新增用户,设置默认密码
async
create
(
pobj
,
queryobj
,
req
)
{
async
create
(
pobj
,
queryobj
,
req
)
{
pobj
.
appid
=
req
.
appid
;
pobj
.
appid
=
req
.
appid
;
pobj
.
owner_id
=
req
.
t
anent
id
;
pobj
.
owner_id
=
req
.
t
ocompany
id
;
//新增用户时,获取当前用户的租户id
//新增用户时,获取当前用户的租户id
pobj
.
tanentor_id
=
req
.
session
.
user
.
tanentor_id
;
pobj
.
tanentor_id
=
req
.
session
.
user
.
tanentor_id
;
var
rtn
=
await
this
.
service
.
createUser
(
pobj
);
var
rtn
=
await
this
.
service
.
createUser
(
pobj
);
...
@@ -177,6 +177,8 @@ class UserCtl extends CtlBase {
...
@@ -177,6 +177,8 @@ class UserCtl extends CtlBase {
// }
// }
//非开放平台登录方法
//非开放平台登录方法
async
goLoginForApp
(
p
,
q
,
req
){
async
goLoginForApp
(
p
,
q
,
req
){
//判断应用的类型,如果是非UI应用
//那么需要直接进入当前应用为上下文
var
app
=
p
;
var
app
=
p
;
var
appid
=
app
.
id
;
var
appid
=
app
.
id
;
var
jumpUrl
=
app
.
authUrl
;
var
jumpUrl
=
app
.
authUrl
;
...
@@ -194,6 +196,7 @@ class UserCtl extends CtlBase {
...
@@ -194,6 +196,7 @@ class UserCtl extends CtlBase {
if
(
existedUser
!=
null
)
{
if
(
existedUser
!=
null
)
{
await
this
.
cacheManager
[
"OpenCodeCache"
].
cache
(
req
.
session
.
id
,
existedUser
,
60
);
await
this
.
cacheManager
[
"OpenCodeCache"
].
cache
(
req
.
session
.
id
,
existedUser
,
60
);
jumpUrl
=
jumpUrl
+
"?code="
+
req
.
session
.
id
;
jumpUrl
=
jumpUrl
+
"?code="
+
req
.
session
.
id
;
//如果非web应用,直接进入后台
return
system
.
getResult
({
user
:
existedUser
,
jumpUrl
:
jumpUrl
});
return
system
.
getResult
({
user
:
existedUser
,
jumpUrl
:
jumpUrl
});
}
else
{
}
else
{
return
system
.
getResultFail
(
-
1
,
"账号或密码有误."
);
return
system
.
getResultFail
(
-
1
,
"账号或密码有误."
);
...
@@ -209,9 +212,16 @@ class UserCtl extends CtlBase {
...
@@ -209,9 +212,16 @@ class UserCtl extends CtlBase {
}
else
{
}
else
{
pobj
.
u
.
isNavto
=
false
;
pobj
.
u
.
isNavto
=
false
;
}
}
//登录其它应用,是当前应用的用户要进入其它应用,上下文是当前应用,用户是当前应用的用户
//这种场景是重用目标应用时,比如管理平台重用
//非重用目标应用,需要切换为目标应用的用户
//而要进入其它应用切换身份,需要在设置上下文时,设为目标应用的ID
pobj
.
u
.
app_id
=
appid
;
pobj
.
u
.
app_id
=
appid
;
if
(
req
.
session
.
toapp
&&
req
.
session
.
toapp
.
id
!=
settings
.
platformid
){
pobj
.
u
.
app_id
=
req
.
session
.
toapp
.
id
;
}
if
(
!
pobj
.
u
.
owner_id
){
//说明不是从平台界面,利用go进入,所以是自主登录
if
(
!
pobj
.
u
.
owner_id
){
//说明不是从平台界面,利用go进入,所以是自主登录
pobj
.
u
.
owner_id
=
pobj
.
t
anent
id
;
pobj
.
u
.
owner_id
=
pobj
.
t
ocompany
id
;
}
}
var
existedUser
=
await
this
.
service
.
getUserByUserNamePwd
(
pobj
.
u
);
var
existedUser
=
await
this
.
service
.
getUserByUserNamePwd
(
pobj
.
u
);
if
(
existedUser
!=
null
)
{
if
(
existedUser
!=
null
)
{
...
@@ -219,6 +229,7 @@ class UserCtl extends CtlBase {
...
@@ -219,6 +229,7 @@ class UserCtl extends CtlBase {
await
this
.
cacheManager
[
"OpenCodeCache"
].
cache
(
req
.
session
.
id
,
existedUser
,
60
);
await
this
.
cacheManager
[
"OpenCodeCache"
].
cache
(
req
.
session
.
id
,
existedUser
,
60
);
jumpUrl
=
jumpUrl
+
"?code="
+
req
.
session
.
id
;
jumpUrl
=
jumpUrl
+
"?code="
+
req
.
session
.
id
;
if
(
req
.
session
.
toapp
)
{
if
(
req
.
session
.
toapp
)
{
//srcKey是进入到平台管理后,显示来源APP的信息;进入其它应用时,也传递以备后用
jumpUrl
=
jumpUrl
+
"&srcKey="
+
req
.
session
.
app
.
appkey
;
jumpUrl
=
jumpUrl
+
"&srcKey="
+
req
.
session
.
app
.
appkey
;
}
}
}
else
{
}
else
{
...
...
bigdata/app/base/controller/impl/common/metaCtl.js
View file @
325f757a
...
@@ -29,7 +29,7 @@ class MetaCtl extends CtlBase {
...
@@ -29,7 +29,7 @@ class MetaCtl extends CtlBase {
if
(
!
appkey
)
{
if
(
!
appkey
)
{
appkey
=
settings
.
appKey
;
appkey
=
settings
.
appKey
;
//为了查询权限
//为了查询权限
req
.
t
anent
id
=
settings
.
platformcompanyid
;
req
.
t
ocompany
id
=
settings
.
platformcompanyid
;
}
}
var
app
=
await
this
.
appS
.
getApp
(
appkey
);
var
app
=
await
this
.
appS
.
getApp
(
appkey
);
var
rs
=
await
this
.
getRsConfig2
(
null
,
req
);
var
rs
=
await
this
.
getRsConfig2
(
null
,
req
);
...
@@ -85,7 +85,7 @@ class MetaCtl extends CtlBase {
...
@@ -85,7 +85,7 @@ class MetaCtl extends CtlBase {
tmpRoles
.
push
(
r
.
code
);
tmpRoles
.
push
(
r
.
code
);
});
});
//按照角色获取权限列表
//按照角色获取权限列表
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
anent
id
);
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
ocompany
id
);
var
codeauthattrs
=
auths
.
map
(
r
=>
{
var
codeauthattrs
=
auths
.
map
(
r
=>
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
return
r
.
authstrs
;
return
r
.
authstrs
;
...
@@ -147,7 +147,7 @@ class MetaCtl extends CtlBase {
...
@@ -147,7 +147,7 @@ class MetaCtl extends CtlBase {
tmpRoles
.
push
(
r
.
code
);
tmpRoles
.
push
(
r
.
code
);
});
});
//按照角色获取权限列表
//按照角色获取权限列表
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
anent
id
);
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
ocompany
id
);
var
codepathattrs
=
auths
.
map
(
r
=>
{
var
codepathattrs
=
auths
.
map
(
r
=>
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
codepath
)
{
if
(
r
.
codepath
)
{
...
@@ -199,7 +199,7 @@ class MetaCtl extends CtlBase {
...
@@ -199,7 +199,7 @@ class MetaCtl extends CtlBase {
tmpRoles
.
push
(
r
.
code
);
tmpRoles
.
push
(
r
.
code
);
});
});
//按照角色获取权限列表
//按照角色获取权限列表
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
anent
id
);
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
ocompany
id
);
var
codepathattrs
=
auths
.
map
(
r
=>
{
var
codepathattrs
=
auths
.
map
(
r
=>
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
codepath
)
{
if
(
r
.
codepath
)
{
...
@@ -385,7 +385,7 @@ class MetaCtl extends CtlBase {
...
@@ -385,7 +385,7 @@ class MetaCtl extends CtlBase {
tmpRoles
.
push
(
r
.
code
);
tmpRoles
.
push
(
r
.
code
);
});
});
//按照角色获取权限列表
//按照角色获取权限列表
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
anent
id
);
var
auths
=
await
this
.
authS
.
findAuthsByRole
(
tmpRoles
,
req
.
session
.
user
.
app_id
,
req
.
t
ocompany
id
);
var
codepathattrs
=
auths
.
map
(
r
=>
{
var
codepathattrs
=
auths
.
map
(
r
=>
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
authstrs
&&
r
.
authstrs
!=
""
)
{
if
(
r
.
codepath
)
{
if
(
r
.
codepath
)
{
...
...
bigdata/app/base/db/impl/auth/roleDao.js
View file @
325f757a
...
@@ -16,7 +16,7 @@ class RoleDao extends Dao{
...
@@ -16,7 +16,7 @@ class RoleDao extends Dao{
// // }
// // }
// }
// }
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"company_id"
]
=
obj
.
t
anent
id
;
w
[
"company_id"
]
=
obj
.
t
ocompany
id
;
return
w
;
return
w
;
}
}
extraModelFilter
(){
extraModelFilter
(){
...
...
bigdata/app/base/db/impl/auth/userDao.js
View file @
325f757a
...
@@ -71,7 +71,7 @@ class UserDao extends Dao{
...
@@ -71,7 +71,7 @@ class UserDao extends Dao{
if
(
obj
.
codepath
&&
obj
.
codepath
!=
""
){
if
(
obj
.
codepath
&&
obj
.
codepath
!=
""
){
if
(
obj
.
codepath
.
indexOf
(
"appuser"
)
>
0
||
obj
.
codepath
.
indexOf
(
"organization"
)
>
0
){
//说明是应用管理员的查询
if
(
obj
.
codepath
.
indexOf
(
"appuser"
)
>
0
||
obj
.
codepath
.
indexOf
(
"organization"
)
>
0
){
//说明是应用管理员的查询
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"owner_id"
]
=
obj
.
t
anent
id
;
w
[
"owner_id"
]
=
obj
.
t
ocompany
id
;
}
}
}
}
if
(
linkAttrs
.
length
>
0
){
if
(
linkAttrs
.
length
>
0
){
...
...
bigdata/app/base/db/impl/common/pconfigDao.js
View file @
325f757a
...
@@ -15,7 +15,7 @@ class PConfigDao extends Dao{
...
@@ -15,7 +15,7 @@ class PConfigDao extends Dao{
// // }
// // }
// }
// }
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"company_id"
]
=
obj
.
t
anent
id
;
w
[
"company_id"
]
=
obj
.
t
ocompany
id
;
return
w
;
return
w
;
}
}
}
}
...
...
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