Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
8timerv2
8timerapiv200
Commits
3f8fd8b6
Commit
3f8fd8b6
authored
Jan 14, 2022
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件权限优化
parent
6e837a8a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
12 deletions
+104
-12
src/main/java/cn/timer/api/bean/disk/DiskCloudDiskUser.java
+5
-2
src/main/java/cn/timer/api/config/enuminterface/JxglEnumInterface.java
+19
-0
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
+48
-10
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
+1
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskCloudDiskUserService.java
+7
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskCloudDiskUserServiceImpl.java
+24
-0
No files found.
src/main/java/cn/timer/api/bean/disk/DiskCloudDiskUser.java
View file @
3f8fd8b6
...
@@ -73,7 +73,7 @@ public class DiskCloudDiskUser extends Model<DiskCloudDiskUser> {
...
@@ -73,7 +73,7 @@ public class DiskCloudDiskUser extends Model<DiskCloudDiskUser> {
/**
/**
* 用户类型:0.超级管理员,1.管理员,2.普通用户
* 用户类型:0.超级管理员,1.管理员,2.普通用户
*/
*/
@ApiModelProperty
(
value
=
"用户类型:0.超级管理员,1.管理员,2.
普通
用户"
)
@ApiModelProperty
(
value
=
"用户类型:0.超级管理员,1.管理员,2.
可编辑用户,3可下载
用户"
)
private
Integer
userRole
;
private
Integer
userRole
;
/**
/**
* 用户权限:r查看,w编辑,x删除,d下载:例如rwxd
* 用户权限:r查看,w编辑,x删除,d下载:例如rwxd
...
@@ -99,7 +99,10 @@ public class DiskCloudDiskUser extends Model<DiskCloudDiskUser> {
...
@@ -99,7 +99,10 @@ public class DiskCloudDiskUser extends Model<DiskCloudDiskUser> {
this
.
userPower
=
"rwd"
;
this
.
userPower
=
"rwd"
;
break
;
break
;
case
2
:
case
2
:
this
.
userPower
=
"rd"
;
this
.
userPower
=
"w"
;
break
;
case
3
:
this
.
userPower
=
"d"
;
break
;
break
;
}
}
}
}
...
...
src/main/java/cn/timer/api/config/enuminterface/JxglEnumInterface.java
View file @
3f8fd8b6
...
@@ -285,5 +285,24 @@ public interface JxglEnumInterface {
...
@@ -285,5 +285,24 @@ public interface JxglEnumInterface {
}
}
}
}
/**
* 云盘-用户类型:0.超级管理员,1.管理员,2.可编辑用户,3.可下载用户
*/
@Getter
enum
DiskCloudUserRole
implements
JxglEnumInterface
{
SUPER_ADMIN_USER
(
0
,
"超级管理员"
),
ADMIN_USER
(
1
,
"管理员"
),
W_USER
(
2
,
"可编辑用户"
)
,
D_USER
(
3
,
"3可下载用户"
);
private
Integer
type
;
private
String
name
;
DiskCloudUserRole
(
Integer
type
,
String
name
)
{
this
.
type
=
type
;
this
.
name
=
name
;
}
}
}
}
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
View file @
3f8fd8b6
...
@@ -19,6 +19,7 @@ import cn.timer.api.controller.disk.sevice.DiskCloudDiskUserService;
...
@@ -19,6 +19,7 @@ import cn.timer.api.controller.disk.sevice.DiskCloudDiskUserService;
import
cn.timer.api.controller.disk.sevice.DiskFilesService
;
import
cn.timer.api.controller.disk.sevice.DiskFilesService
;
import
cn.timer.api.dto.disk.DiskCatalogueDto
;
import
cn.timer.api.dto.disk.DiskCatalogueDto
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCloudDiskUserParam
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.ResultUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
@@ -83,8 +84,15 @@ public class DiskCatalogueController {
...
@@ -83,8 +84,15 @@ public class DiskCatalogueController {
if
(
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueDto
.
getType
())
&&
if
(
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueDto
.
getType
())
&&
!
StringUtils
.
isEmpty
(
diskCatalogueDto
.
getId
())
&&
diskCatalogueDto
.
getId
()
>
0
){
!
StringUtils
.
isEmpty
(
diskCatalogueDto
.
getId
())
&&
diskCatalogueDto
.
getId
()
>
0
){
diskCatalogueDto
.
setUserId
(
userBean
.
getEmpNum
());
diskCatalogueDto
.
setUserId
(
userBean
.
getEmpNum
());
if
(!
diskCloudDiskUserService
.
getDiskUserRole
(
diskCatalogueDto
,
DiskCatalogue
.
builder
().
id
(
diskCatalogueDto
.
getId
()).
build
().
selectById
())){
if
(!
StringUtils
.
isEmpty
(
catalogue
)
&&
!
catalogue
.
getCreateUserId
().
equals
(
userBean
.
getEmpNum
())){
return
ResultUtil
.
error
(
"无权限,操作失败!"
);
DiskCloudDiskUserParam
param
=
new
DiskCloudDiskUserParam
();
param
.
setUserId
(
userBean
.
getEmpNum
());
param
.
setOrgId
(
userBean
.
getOrgCode
());
param
.
setCatalogueId
(
diskCatalogueDto
.
getId
());
DiskCloudDiskUser
user
=
diskCloudDiskUserService
.
getUserRoleBySharedSpace
(
param
);
if
(
StringUtils
.
isEmpty
(
user
)
||
StringUtils
.
isEmpty
(
user
.
getUserRole
())
||
user
.
getUserRole
()
>
JxglEnumInterface
.
DiskCloudUserRole
.
ADMIN_USER
.
getType
()){
return
ResultUtil
.
error
(
"无权限,操作失败!"
);
}
}
}
}
}
...
@@ -98,9 +106,11 @@ public class DiskCatalogueController {
...
@@ -98,9 +106,11 @@ public class DiskCatalogueController {
}
else
{
}
else
{
diskCatalogue
.
setParentIds
(
parentIds
);
diskCatalogue
.
setParentIds
(
parentIds
);
}
}
diskCatalogue
.
setCreateUserId
(
userBean
.
getEmpNum
());
if
(
StringUtils
.
isEmpty
(
diskCatalogueDto
.
getId
())
||
diskCatalogueDto
.
getId
()
<=
0
){
diskCatalogue
.
setOrgId
(
userBean
.
getOrgCode
());
diskCatalogue
.
setCreateUserId
(
userBean
.
getEmpNum
());
}
diskCatalogue
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
diskCatalogue
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
diskCatalogue
.
setOrgId
(
userBean
.
getOrgCode
());
diskCatalogue
.
setUpdateUserId
(
userBean
.
getEmpNum
());
diskCatalogue
.
setUpdateUserId
(
userBean
.
getEmpNum
());
Boolean
count
=
diskCatalogue
.
insertOrUpdate
();
Boolean
count
=
diskCatalogue
.
insertOrUpdate
();
// 云盘修改
// 云盘修改
...
@@ -178,19 +188,40 @@ public class DiskCatalogueController {
...
@@ -178,19 +188,40 @@ public class DiskCatalogueController {
@ApiOperationSupport
(
order
=
2
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Object
>
myfile
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
)
{
public
Result
<
Object
>
myfile
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
)
{
try
{
try
{
diskCatalogueParam
.
setUserId
(
userBean
.
getEmpNum
());
//
diskCatalogueParam.setUserId(userBean.getEmpNum());
diskCatalogueParam
.
setOrgId
(
userBean
.
getOrgCode
());
diskCatalogueParam
.
setOrgId
(
userBean
.
getOrgCode
());
// 获取文件夹
// 获取文件夹
List
<
DiskCatalogue
>
diskCatalogueList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
List
<
DiskCatalogue
>
diskCatalogueList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
.
lambda
().
eq
(
DiskCatalogue:
:
getOrgId
,
userBean
.
getOrgCode
())
.
lambda
().
eq
(
DiskCatalogue:
:
getOrgId
,
userBean
.
getOrgCode
())
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
userBean
.
getEmpNum
())
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
diskCatalogueParam
.
getUserId
())
.
eq
(
DiskCatalogue:
:
getParentId
,
diskCatalogueParam
.
getParentId
())
.
eq
(
DiskCatalogue:
:
getParentId
,
diskCatalogueParam
.
getParentId
())
.
eq
(
DiskCatalogue:
:
getType
,
diskCatalogueParam
.
getType
())
.
eq
(
DiskCatalogue:
:
getType
,
diskCatalogueParam
.
getType
())
.
eq
(
DiskCatalogue:
:
getDeleteFlag
,
0
)
.
eq
(
DiskCatalogue:
:
getDeleteFlag
,
0
)
);
);
if
(
StringUtils
.
isEmpty
(
diskCatalogueParam
.
getParentId
())
||
diskCatalogueParam
.
getParentId
()
==
0
// 别人的空间,自己的权限级别
if
((
StringUtils
.
isEmpty
(
diskCatalogueParam
.
getParentId
())
||
diskCatalogueParam
.
getParentId
()
>
0
)
&&
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueParam
.
getType
())){
&&
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueParam
.
getType
())){
DiskCloudDiskUserParam
param
=
new
DiskCloudDiskUserParam
();
param
.
setUserId
(
userBean
.
getEmpNum
());
param
.
setOrgId
(
userBean
.
getOrgCode
());
param
.
setCatalogueId
(
diskCatalogueParam
.
getParentId
());
DiskCloudDiskUser
user
=
diskCloudDiskUserService
.
getUserRoleBySharedSpace
(
param
);
if
(!
StringUtils
.
isEmpty
(
user
)
&&
!
StringUtils
.
isEmpty
(
user
.
getId
())){
for
(
DiskCatalogue
entity
:
diskCatalogueList
)
{
entity
.
setUserRole
(
user
.
getUserRole
());
entity
.
setUserPower
(
user
.
getUserPower
());
}
}
}
if
((
StringUtils
.
isEmpty
(
diskCatalogueParam
.
getParentId
())
||
diskCatalogueParam
.
getParentId
()
==
0
)
&&
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueParam
.
getType
())){
// 自己的空间默认设置为超级管理员
for
(
DiskCatalogue
entity
:
diskCatalogueList
)
{
entity
.
setUserRole
(
JxglEnumInterface
.
DiskCloudUserRole
.
SUPER_ADMIN_USER
.
getType
());
entity
.
setUserPower
(
"rwxd"
);
}
//空间 获取有权限的
//空间 获取有权限的
diskCatalogueParam
.
setUserId
(
userBean
.
getEmpNum
());
List
<
DiskCatalogue
>
diskCatalogueList2
=
diskCloudDiskUserService
.
getDiskCatalogueList
(
diskCatalogueParam
);
List
<
DiskCatalogue
>
diskCatalogueList2
=
diskCloudDiskUserService
.
getDiskCatalogueList
(
diskCatalogueParam
);
if
(!
CollectionUtils
.
isEmpty
(
diskCatalogueList2
)){
if
(!
CollectionUtils
.
isEmpty
(
diskCatalogueList2
)){
diskCatalogueList
.
addAll
(
diskCatalogueList2
);
diskCatalogueList
.
addAll
(
diskCatalogueList2
);
...
@@ -291,10 +322,17 @@ public class DiskCatalogueController {
...
@@ -291,10 +322,17 @@ public class DiskCatalogueController {
if
(
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueDto
.
getType
())
&&
if
(
JxglEnumInterface
.
DiskCatalogueType
.
DISK_YUN
.
getType
().
equals
(
diskCatalogueDto
.
getType
())
&&
!
StringUtils
.
isEmpty
(
diskCatalogueDto
.
getId
())
&&
diskCatalogueDto
.
getId
()
>
0
){
!
StringUtils
.
isEmpty
(
diskCatalogueDto
.
getId
())
&&
diskCatalogueDto
.
getId
()
>
0
){
diskCatalogueDto
.
setUserId
(
userBean
.
getEmpNum
());
diskCatalogueDto
.
setUserId
(
userBean
.
getEmpNum
());
if
(!
diskCloudDiskUserService
.
getDiskUserRole
(
diskCatalogueDto
,
DiskCatalogue
.
builder
().
id
(
diskCatalogueDto
.
getId
()).
build
().
selectById
())){
if
(!
StringUtils
.
isEmpty
(
catalogue
)
&&
!
catalogue
.
getCreateUserId
().
equals
(
userBean
.
getEmpNum
()))
{
return
ResultUtil
.
error
(
"无权限,操作失败!"
);
DiskCloudDiskUserParam
param
=
new
DiskCloudDiskUserParam
();
param
.
setUserId
(
userBean
.
getEmpNum
());
param
.
setOrgId
(
userBean
.
getOrgCode
());
param
.
setCatalogueId
(
diskCatalogueDto
.
getId
());
DiskCloudDiskUser
user
=
diskCloudDiskUserService
.
getUserRoleBySharedSpace
(
param
);
if
(
StringUtils
.
isEmpty
(
user
)
||
StringUtils
.
isEmpty
(
user
.
getUserRole
())
||
user
.
getUserRole
()
>
JxglEnumInterface
.
DiskCloudUserRole
.
ADMIN_USER
.
getType
())
{
return
ResultUtil
.
error
(
"无权限,操作失败!"
);
}
}
}
// 删除之前的成员
全部重新添加
// 删除之前的成员
DiskCloudDiskUser
.
builder
().
deleteFlag
(
1
).
build
().
update
(
new
QueryWrapper
<
DiskCloudDiskUser
>()
DiskCloudDiskUser
.
builder
().
deleteFlag
(
1
).
build
().
update
(
new
QueryWrapper
<
DiskCloudDiskUser
>()
.
lambda
().
eq
(
DiskCloudDiskUser:
:
getOrgId
,
userBean
.
getOrgCode
())
.
lambda
().
eq
(
DiskCloudDiskUser:
:
getOrgId
,
userBean
.
getOrgCode
())
.
eq
(
DiskCloudDiskUser:
:
getCatalogueId
,
catalogue
.
getId
()));
.
eq
(
DiskCloudDiskUser:
:
getCatalogueId
,
catalogue
.
getId
()));
...
...
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
View file @
3f8fd8b6
...
@@ -179,6 +179,7 @@ public class DiskFilesController {
...
@@ -179,6 +179,7 @@ public class DiskFilesController {
entity
.
setId
(
diskFiles
.
getId
());
entity
.
setId
(
diskFiles
.
getId
());
entity
.
setTitle
(
diskFilesParam
.
getName
());
entity
.
setTitle
(
diskFilesParam
.
getName
());
entity
.
setUpdateUserId
(
userBean
.
getEmpNum
());
entity
.
setUpdateUserId
(
userBean
.
getEmpNum
());
entity
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
UPDATE_LOG
.
getType
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
UPDATE_LOG
.
getType
());
if
(!
StringUtils
.
isEmpty
(
diskFilesParam
.
getDeleteFlag
())){
if
(!
StringUtils
.
isEmpty
(
diskFilesParam
.
getDeleteFlag
())){
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskCloudDiskUserService.java
View file @
3f8fd8b6
...
@@ -28,4 +28,11 @@ public interface DiskCloudDiskUserService {
...
@@ -28,4 +28,11 @@ public interface DiskCloudDiskUserService {
* @return
* @return
*/
*/
List
<
DiskCatalogue
>
getDiskCatalogueList
(
DiskCatalogueParam
diskCatalogueParam
);
List
<
DiskCatalogue
>
getDiskCatalogueList
(
DiskCatalogueParam
diskCatalogueParam
);
/**
* 获取空间操作权限
* @param diskCloudDiskUserParam
* @return
*/
DiskCloudDiskUser
getUserRoleBySharedSpace
(
DiskCloudDiskUserParam
diskCloudDiskUserParam
);
}
}
src/main/java/cn/timer/api/controller/disk/sevice/DiskCloudDiskUserServiceImpl.java
View file @
3f8fd8b6
...
@@ -46,4 +46,28 @@ public class DiskCloudDiskUserServiceImpl implements DiskCloudDiskUserService {
...
@@ -46,4 +46,28 @@ public class DiskCloudDiskUserServiceImpl implements DiskCloudDiskUserService {
public
List
<
DiskCatalogue
>
getDiskCatalogueList
(
DiskCatalogueParam
diskCatalogueParam
)
{
public
List
<
DiskCatalogue
>
getDiskCatalogueList
(
DiskCatalogueParam
diskCatalogueParam
)
{
return
diskCloudDiskUserMapper
.
getDiskCatalogueList
(
diskCatalogueParam
);
return
diskCloudDiskUserMapper
.
getDiskCatalogueList
(
diskCatalogueParam
);
}
}
@Override
public
DiskCloudDiskUser
getUserRoleBySharedSpace
(
DiskCloudDiskUserParam
diskCloudDiskUserParam
)
{
DiskCloudDiskUser
dcdUser
=
DiskCloudDiskUser
.
builder
().
build
();
DiskCatalogue
catalogue
=
DiskCatalogue
.
builder
().
id
(
diskCloudDiskUserParam
.
getCatalogueId
()).
build
().
selectById
();
if
(
StringUtils
.
isEmpty
(
catalogue
)){
return
dcdUser
;
}
if
(
catalogue
.
getParentId
()
>
0
){
String
[]
parent
=
catalogue
.
getParentIds
().
split
(
","
);
catalogue
=
DiskCatalogue
.
builder
().
id
(
Integer
.
parseInt
(
parent
[
0
])).
build
().
selectById
();
}
dcdUser
=
dcdUser
.
selectOne
(
new
QueryWrapper
<
DiskCloudDiskUser
>()
.
lambda
().
eq
(
DiskCloudDiskUser:
:
getUserId
,
diskCloudDiskUserParam
.
getUserId
())
.
eq
(
DiskCloudDiskUser:
:
getOrgId
,
diskCloudDiskUserParam
.
getOrgId
())
.
eq
(
DiskCloudDiskUser:
:
getCatalogueId
,
catalogue
.
getId
()));
if
(
StringUtils
.
isEmpty
(
dcdUser
)
&&
catalogue
.
getCreateUserId
().
equals
(
diskCloudDiskUserParam
.
getUserId
())){
dcdUser
=
DiskCloudDiskUser
.
builder
().
build
();
dcdUser
.
setId
(
0
);
dcdUser
.
setUserRole
(
JxglEnumInterface
.
DiskCloudUserRole
.
SUPER_ADMIN_USER
.
getType
());
dcdUser
.
setUserPower
(
"rwxd"
);
}
return
dcdUser
;
}
}
}
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