diff --git a/src/main/java/org/support/project/knowledge/config/UserConfig.java b/src/main/java/org/support/project/knowledge/config/UserConfig.java index 6c50a7b75..ae522d33e 100644 --- a/src/main/java/org/support/project/knowledge/config/UserConfig.java +++ b/src/main/java/org/support/project/knowledge/config/UserConfig.java @@ -13,5 +13,6 @@ public class UserConfig { public static final String THEMA = "THEMA"; public static final String HIGHLIGHT = "HIGHLIGHT"; + public static final String STEALTH_ACCESS = "STEALTH_ACCESS"; } diff --git a/src/main/java/org/support/project/knowledge/control/admin/UsersControl.java b/src/main/java/org/support/project/knowledge/control/admin/UsersControl.java index e636538c2..ac8521107 100644 --- a/src/main/java/org/support/project/knowledge/control/admin/UsersControl.java +++ b/src/main/java/org/support/project/knowledge/control/admin/UsersControl.java @@ -6,12 +6,14 @@ import java.util.Map; import org.support.project.common.bean.ValidateError; +import org.support.project.common.config.INT_FLAG; import org.support.project.common.util.PropertyUtil; import org.support.project.common.util.StringUtils; import org.support.project.di.DI; import org.support.project.di.Instance; import org.support.project.knowledge.config.AppConfig; import org.support.project.knowledge.config.SystemConfig; +import org.support.project.knowledge.config.UserConfig; import org.support.project.knowledge.control.Control; import org.support.project.knowledge.logic.MailLogic; import org.support.project.knowledge.logic.UserLogicEx; @@ -25,10 +27,12 @@ import org.support.project.web.dao.ProvisionalRegistrationsDao; import org.support.project.web.dao.RolesDao; import org.support.project.web.dao.SystemConfigsDao; +import org.support.project.web.dao.UserConfigsDao; import org.support.project.web.dao.UsersDao; import org.support.project.web.entity.ProvisionalRegistrationsEntity; import org.support.project.web.entity.RolesEntity; import org.support.project.web.entity.SystemConfigsEntity; +import org.support.project.web.entity.UserConfigsEntity; import org.support.project.web.entity.UsersEntity; import org.support.project.web.exception.InvalidParamException; @@ -169,10 +173,22 @@ public Boundary view_edit() throws InvalidParamException { // 登録されているロールをセット setSystemRoles(user); + + // 保存されているユーザの設定情報をセット + setUserConfigs(user); return forward("view_edit.jsp"); } + private void setUserConfigs(UsersEntity user) { + UserConfigsEntity stealth = UserConfigsDao.get().selectOnKey(UserConfig.STEALTH_ACCESS, AppConfig.get().getSystemName(), user.getUserId()); + if (stealth != null) { + setAttribute(UserConfig.STEALTH_ACCESS, stealth.getConfigValue()); + } else { + setAttribute(UserConfig.STEALTH_ACCESS, String.valueOf(INT_FLAG.OFF.getValue())); + } + } + /** * ユーザを追加 * @@ -213,6 +229,18 @@ public Boundary create() { user = UserLogicEx.get().insert(user, roles); setAttributeOnProperty(user); + String stealth = getParam("STEALTH_ACCESS"); + if ("1".equals(stealth)) { + UserConfigsEntity config = new UserConfigsEntity(UserConfig.STEALTH_ACCESS, AppConfig.get().getSystemName(), user.getUserId()); + config.setConfigValue("1"); + UserConfigsDao.get().save(config); + } else { + UserConfigsEntity config = UserConfigsDao.get().selectOnKey(UserConfig.STEALTH_ACCESS, AppConfig.get().getSystemName(), user.getUserId()); + if (stealth != null) { + UserConfigsDao.get().physicalDelete(config); + } + } + // 登録されているロールをセット setSystemRoles(user); @@ -280,6 +308,18 @@ public Boundary save() { user = UserLogicEx.get().update(user, roles, getLoginedUser()); setAttributeOnProperty(user); + String stealth = getParam("STEALTH_ACCESS"); + if ("1".equals(stealth)) { + UserConfigsEntity config = new UserConfigsEntity(UserConfig.STEALTH_ACCESS, AppConfig.get().getSystemName(), user.getUserId()); + config.setConfigValue("1"); + UserConfigsDao.get().save(config); + } else { + UserConfigsEntity config = UserConfigsDao.get().selectOnKey(UserConfig.STEALTH_ACCESS, AppConfig.get().getSystemName(), user.getUserId()); + if (stealth != null) { + UserConfigsDao.get().physicalDelete(config); + } + } + // 登録されているロールをセット setSystemRoles(user); diff --git a/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java b/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java index 0ef38c737..de00ed34c 100644 --- a/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java +++ b/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java @@ -18,6 +18,7 @@ import org.support.project.di.Instance; import org.support.project.knowledge.config.AppConfig; import org.support.project.knowledge.config.SystemConfig; +import org.support.project.knowledge.config.UserConfig; import org.support.project.knowledge.control.KnowledgeControlBase; import org.support.project.knowledge.dao.CommentsDao; import org.support.project.knowledge.dao.DraftItemValuesDao; @@ -77,7 +78,6 @@ import org.support.project.web.entity.UserConfigsEntity; import org.support.project.web.entity.UsersEntity; import org.support.project.web.exception.InvalidParamException; -import org.support.project.web.logic.UserLogic; /** * ナレッジ操作のコントロール @@ -225,7 +225,10 @@ public Boundary view() throws InvalidParamException, ParseException { List stocks = StocksDao.get().selectStockOnKnowledge(entity, loginedUser); setAttribute("stocks", stocks); - ActivityLogic.get().processActivity(Activity.KNOWLEDGE_SHOW, getLoginedUser(), DateUtils.now(), entity); + UserConfigsEntity stealth = UserConfigsDao.get().selectOnKey(UserConfig.STEALTH_ACCESS, AppConfig.get().getSystemName(), getLoginUserId()); + if (stealth == null || !"1".equals(stealth.getConfigValue())) { + ActivityLogic.get().processActivity(Activity.KNOWLEDGE_SHOW, getLoginedUser(), DateUtils.now(), entity); + } long point = KnowledgesDao.get().selectPoint(entity.getKnowledgeId()); setAttribute("point", point); diff --git a/src/main/java/org/support/project/knowledge/dao/KnowledgesDao.java b/src/main/java/org/support/project/knowledge/dao/KnowledgesDao.java index 183bf27f5..840873241 100644 --- a/src/main/java/org/support/project/knowledge/dao/KnowledgesDao.java +++ b/src/main/java/org/support/project/knowledge/dao/KnowledgesDao.java @@ -2,7 +2,6 @@ import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Date; import java.util.List; import org.support.project.aop.Aspect; diff --git a/src/main/resources/appresource.properties b/src/main/resources/appresource.properties index c38642688..10e97eb8f 100644 --- a/src/main/resources/appresource.properties +++ b/src/main/resources/appresource.properties @@ -443,6 +443,7 @@ knowledge.user.add.title=Add User knowledge.user.edit.title=Edit User knowledge.user.invalid.same.password=Password and Confirm Password has a different knowledge.user.mail.exist=The Email Address already registered +knowledge.user.stealth.access=Stealth Access to article knowledge.group.view.title=View Group knowledge.group.view.label.groupname=Group name diff --git a/src/main/resources/appresource_ja.properties b/src/main/resources/appresource_ja.properties index a3b1c1d74..0a0425671 100644 --- a/src/main/resources/appresource_ja.properties +++ b/src/main/resources/appresource_ja.properties @@ -443,6 +443,7 @@ knowledge.user.add.title=ユーザの追加 knowledge.user.edit.title=ユーザの更新 knowledge.user.invalid.same.password=PasswordとConfirm Passwordが違っています knowledge.user.mail.exist=既に登録されているEmail Addressです +knowledge.user.stealth.access=記事へアクセスした履歴を通知しない knowledge.group.view.title=グループ表示 knowledge.group.view.label.groupname=グループ名 diff --git a/src/main/webapp/WEB-INF/views/admin/users/view_add.jsp b/src/main/webapp/WEB-INF/views/admin/users/view_add.jsp index 8df8ff255..b934be1b1 100644 --- a/src/main/webapp/WEB-INF/views/admin/users/view_add.jsp +++ b/src/main/webapp/WEB-INF/views/admin/users/view_add.jsp @@ -23,54 +23,62 @@
-
- - " /> -
-
- - " /> -
- -
- - " /> -
-
- - " /> -
- -
-
- - - -
- - " /> - - - - " - class="btn btn-success" role="button"> <%= jspUtil.label("label.backlist") %> - +
+ + " /> +
+
+ + " /> +
+ +
+ + " /> +
+
+ + " /> +
+ +
+
+ + + +
+ +
+
+ +
+ + + " /> + + + " + class="btn btn-success" role="button"> <%= jspUtil.label("label.backlist") %> +
diff --git a/src/main/webapp/WEB-INF/views/admin/users/view_edit.jsp b/src/main/webapp/WEB-INF/views/admin/users/view_edit.jsp index 0e6423458..c1d7f5df4 100644 --- a/src/main/webapp/WEB-INF/views/admin/users/view_edit.jsp +++ b/src/main/webapp/WEB-INF/views/admin/users/view_edit.jsp @@ -122,6 +122,14 @@ function deleteUser() { +
+
+ +
+