diff --git a/pom.xml b/pom.xml
index d153741..2d6927e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -294,6 +294,7 @@
org.springframework.boot
spring-boot-maven-plugin
+ 2.3.5.RELEASE
forest
diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java
index be8d1aa..be9d57b 100644
--- a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java
+++ b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java
@@ -1,7 +1,6 @@
package com.rymcu.forest.service.impl;
import com.rymcu.forest.core.constant.NotificationConstant;
-import com.rymcu.forest.core.constant.ProjectConstant;
import com.rymcu.forest.core.service.AbstractService;
import com.rymcu.forest.dto.*;
import com.rymcu.forest.entity.Article;
@@ -286,7 +285,7 @@ public class ArticleServiceImpl extends AbstractService implements Arti
throw new BaseApiException(ErrorCode.INVALID_TOKEN);
}
StringBuilder shareUrl = new StringBuilder(article.getArticlePermalink());
- shareUrl.append("?s=").append(user.getNickname());
+ shareUrl.append("?s=").append(user.getAccount());
Map map = new HashMap(1);
map.put("shareUrl", shareUrl);
return map;
@@ -323,7 +322,7 @@ public class ArticleServiceImpl extends AbstractService implements Arti
Map map = new HashMap(2);
Article article = articleMapper.selectByPrimaryKey(idArticle);
if (Objects.nonNull(article)) {
- if (isAuthor(article.getArticleAuthorId())) {
+ if (isAuthor(article.getArticleAuthorId()) || hasAdminPermission()) {
article.setArticleTags(tags);
articleMapper.updateArticleTags(idArticle, tags);
tagService.saveTagArticle(article, "");
@@ -339,6 +338,15 @@ public class ArticleServiceImpl extends AbstractService implements Arti
return map;
}
+ private boolean hasAdminPermission() throws BaseApiException {
+ User user = UserUtils.getCurrentUserByToken();
+ if (Objects.nonNull(user)) {
+ Integer userRoleWeight = userService.findRoleWeightsByUser(user.getIdUser());
+ return userRoleWeight <= ADMIN_ROLE_WEIGHTS;
+ }
+ return false;
+ }
+
private boolean isAuthor(Integer idUser) throws BaseApiException {
User user = UserUtils.getCurrentUserByToken();
if (Objects.nonNull(user)) {