Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bd22c4634 |
@@ -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>
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
*/
|
*/
|
||||||
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>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
@@ -17,4 +19,8 @@ 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_"),
|
||||||
|
|||||||
@@ -24,6 +24,31 @@ 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