Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bd22c4634 | ||
|
|
5b01d3274a | ||
|
|
d6d3d61bdd | ||
|
|
12599ff4db | ||
|
|
2f0b06a541 |
@@ -1,13 +1,15 @@
|
|||||||
# 项目简介
|
# 项目简介
|
||||||
zyplayer-doc是一款适合团队和个人使用的WIKI文档管理工具,同时还包含数据库文档、Api接口文档。
|
zyplayer-doc是一款适合团队和个人使用的WIKI文档管理工具,同时还包含数据库文档、Api接口文档。
|
||||||
|
|
||||||
在线文档:[zyplayer-doc使用文档](http://doc.zyplayer.com/doc-wiki#/docs/w4eSzPWvQRSBvaCHZS8t6d)
|
在线文档:[zyplayer-doc使用文档](http://doc.zyplayer.com/doc-wiki#/integrate/zyplayer-doc)
|
||||||
|
|
||||||
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com)
|
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com)
|
||||||
|
|
||||||
欢迎有想法的同学一起来完善,如果觉得不错就给个Star鼓励下呗!作为给项目快速更新的动力!
|
欢迎有想法的同学一起来完善,如果觉得不错就给个Star鼓励下呗!作为给项目快速更新的动力!
|
||||||
|
|
||||||
欢迎加群讨论,QQ群号:466363173
|
欢迎加入微信群与我们一起交流
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
# 快速启动
|
# 快速启动
|
||||||
## 相关依赖
|
## 相关依赖
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -159,7 +159,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.78</version>
|
<version>1.2.83</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.zyplayer.doc.data.service.manage;
|
|||||||
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -12,5 +14,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @since 2019-03-13
|
* @since 2019-03-13
|
||||||
*/
|
*/
|
||||||
public interface WikiSpaceService extends IService<WikiSpace> {
|
public interface WikiSpaceService extends IService<WikiSpace> {
|
||||||
|
|
||||||
|
List<Long> getViewAuthSpaceIds();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.zyplayer.doc.data.service.manage.WikiSpaceService;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
@@ -16,5 +18,9 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WikiSpaceServiceImpl extends ServiceImpl<WikiSpaceMapper, WikiSpace> implements WikiSpaceService {
|
public class WikiSpaceServiceImpl extends ServiceImpl<WikiSpaceMapper, WikiSpace> implements WikiSpaceService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getViewAuthSpaceIds() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ public class WikiSpaceController {
|
|||||||
LambdaQueryWrapper<WikiSpace> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WikiSpace> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(WikiSpace::getDelFlag, 0);
|
wrapper.eq(WikiSpace::getDelFlag, 0);
|
||||||
wrapper.eq(wikiSpace.getId() != null, WikiSpace::getId, wikiSpace.getId());
|
wrapper.eq(wikiSpace.getId() != null, WikiSpace::getId, wikiSpace.getId());
|
||||||
wrapper.and(con -> con.and(conSub -> conSub.eq(WikiSpace::getType, 3).eq(WikiSpace::getCreateUserId, currentUser.getUserId())).or().in(WikiSpace::getType, 1, 2));
|
wrapper.and(con ->
|
||||||
|
con.and(conSub -> conSub.eq(WikiSpace::getType, 3).eq(WikiSpace::getCreateUserId, currentUser.getUserId()))
|
||||||
|
.or(conSub -> conSub.eq(WikiSpace::getType, 3).eq(WikiSpace::getCreateUserId, currentUser.getUserId()))
|
||||||
|
.or().in(WikiSpace::getType, 1, 2)
|
||||||
|
);
|
||||||
// 收藏的空间
|
// 收藏的空间
|
||||||
List<WikiSpaceFavorite> favoriteList = wikiSpaceFavoriteService.myFavoriteSpaceList();
|
List<WikiSpaceFavorite> favoriteList = wikiSpaceFavoriteService.myFavoriteSpaceList();
|
||||||
Set<Long> favoriteSpaceIds = favoriteList.stream().map(WikiSpaceFavorite::getSpaceId).collect(Collectors.toSet());
|
Set<Long> favoriteSpaceIds = favoriteList.stream().map(WikiSpaceFavorite::getSpaceId).collect(Collectors.toSet());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ package com.zyplayer.doc.wiki.framework.consts;
|
|||||||
public enum WikiAuthType {
|
public enum WikiAuthType {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
CREATE_PAGE(1, "WIKI_CREATE_PAGE_"),
|
CREATE_PAGE(1, "WIKI_CREATE_PAGE_"),
|
||||||
|
VIEW_PAGE(2, "WIKI_VIEW_PAGE_"),
|
||||||
EDIT_PAGE(2, "WIKI_EDIT_PAGE_"),
|
EDIT_PAGE(2, "WIKI_EDIT_PAGE_"),
|
||||||
@Deprecated
|
@Deprecated
|
||||||
COMMENT_PAGE(3, "WIKI_COMMENT_PAGE_"),
|
COMMENT_PAGE(3, "WIKI_COMMENT_PAGE_"),
|
||||||
|
|||||||
@@ -23,6 +23,31 @@ import java.util.Objects;
|
|||||||
public class WikiPageAuthService {
|
public class WikiPageAuthService {
|
||||||
|
|
||||||
private final UserGroupAuthMapper userGroupAuthMapper;
|
private final UserGroupAuthMapper userGroupAuthMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否具有查看权限
|
||||||
|
*/
|
||||||
|
public String canView(WikiSpace wikiSpaceSel, Integer editType, Long pageId, Long currentUserId) {
|
||||||
|
if (wikiSpaceSel == null || Objects.equals(editType, 1)) {
|
||||||
|
return "当前页面不允许查看!";
|
||||||
|
}
|
||||||
|
// 私人空间不允许调用接口获取文章
|
||||||
|
if (SpaceType.isOthersPrivate(wikiSpaceSel.getType(), currentUserId, wikiSpaceSel.getCreateUserId())) {
|
||||||
|
return "您没有权限修改该空间的文章!";
|
||||||
|
}
|
||||||
|
// 空间不是自己的,也没有权限
|
||||||
|
if (SpaceType.isOthersPersonal(wikiSpaceSel.getType(), currentUserId, wikiSpaceSel.getCreateUserId())) {
|
||||||
|
boolean pageAuth = DocUserUtil.haveCustomAuth(WikiAuthType.VIEW_PAGE.getCode(), DocSysType.WIKI.getType(), DocSysModuleType.Wiki.PAGE.getType(), pageId);
|
||||||
|
if (!pageAuth) {
|
||||||
|
// 在空间上直接授权了分组的权限,在这个分组里就具有权限
|
||||||
|
Long authId = userGroupAuthMapper.haveAuth(wikiSpaceSel.getId(), DocSysType.WIKI.getType(), WikiAuthType.VIEW_PAGE.getType(), currentUserId);
|
||||||
|
if (authId == null) {
|
||||||
|
return "您没有查看该文章的权限!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否具有编辑权限
|
* 是否具有编辑权限
|
||||||
|
|||||||
Reference in New Issue
Block a user