You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/02/21 06:10:52 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a change in pull request #8457: [Feature-8386][Server] Custom timezone - Add timezone into user info

caishunfeng commented on a change in pull request #8457:
URL: https://github.com/apache/dolphinscheduler/pull/8457#discussion_r810803307



##########
File path: dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.4_schema/mysql/dolphinscheduler_ddl.sql
##########
@@ -14,3 +14,5 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 */
+
+ALTER TABLE `t_ds_user` ADD COLUMN `time_zone` varchar(4) COMMENT 'time zone, e.g. +8' AFTER `state`;

Review comment:
       ```suggestion
   ALTER TABLE `t_ds_user` ADD COLUMN `time_zone` varchar(4) COMMENT 'time zone' AFTER `state`;
   ```

##########
File path: dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java
##########
@@ -269,13 +269,13 @@ public void testUpdateUser() {
         String userPassword = "userTest0001";
         try {
             //user not exist
-            Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, "3443@qq.com", 1, "13457864543", "queue", 1);
+            Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, "3443@qq.com", 1, "13457864543", "queue", 1, "+8");

Review comment:
       ```suggestion
               Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, "3443@qq.com", 1, "13457864543", "queue", 1, "Asia/Shanghai");
   ```

##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
##########
@@ -205,6 +207,8 @@ public User createUser(String userName,
             queue = "";
         }
         user.setQueue(queue);
+        String defaultTimeZone = ZoneId.systemDefault().getRules().getOffset(Instant.now()).getId();
+        user.setTimeZone("GMT" + defaultTimeZone);

Review comment:
       Is it better to init the user timezone null? If timezone null, use the server default timezone for date convert. What do you think?

##########
File path: dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java
##########
@@ -269,13 +269,13 @@ public void testUpdateUser() {
         String userPassword = "userTest0001";
         try {
             //user not exist
-            Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, "3443@qq.com", 1, "13457864543", "queue", 1);
+            Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, "3443@qq.com", 1, "13457864543", "queue", 1, "+8");
             Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
             logger.info(result.toString());
 
             //success
             when(userMapper.selectById(1)).thenReturn(getUser());
-            result = usersService.updateUser(getLoginUser(), 1, userName, userPassword, "32222s@qq.com", 1, "13457864543", "queue", 1);
+            result = usersService.updateUser(getLoginUser(), 1, userName, userPassword, "32222s@qq.com", 1, "13457864543", "queue", 1, "+8");

Review comment:
       ```suggestion
               result = usersService.updateUser(getLoginUser(), 1, userName, userPassword, "32222s@qq.com", 1, "13457864543", "queue", 1, "Asia/Shanghai");
   ```

##########
File path: dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql
##########
@@ -979,7 +980,7 @@ VALUES ('1,2', 1, 'default admin warning group', 'default admin warning group',
 -- ----------------------------
 INSERT INTO t_ds_user
 VALUES ('1', 'admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', '', '0', '2018-03-27 15:48:50',
-        '2018-10-24 17:40:22', null, 1);
+        '2018-10-24 17:40:22', null, 1, 'GMT+8');

Review comment:
       ```suggestion
           '2018-10-24 17:40:22', null, 1, null);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org