You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/19 09:37:13 UTC

[GitHub] [incubator-shenyu] li-keguo opened a new pull request, #3586: [ISSUE #3221]Feature/record log in user

li-keguo opened a new pull request, #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586

   about issue #3221
   
   work list:
   
   - [x] ecord log in user
   


-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586#discussion_r901087117


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/model/event/user/UserUpdatedEvent.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.user;
+
+import org.apache.shenyu.admin.model.entity.DashboardUserDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+
+/**
+ * UserUpdatedEvent.
+ */
+public class UserUpdatedEvent extends UserChangedEvent {
+    
+    
+    /**
+     * Create a new {@code UserUpdatedEvent}.operator is unknown.
+     *
+     * @param source   Current user state
+     * @param before   before user state
+     * @param operator operator
+     */
+    public UserUpdatedEvent(final DashboardUserDO source, final DashboardUserDO before, final String operator) {
+        super(source, before, EventTypeEnum.USER_UPDATE, operator);
+    }
+    
+    /**
+     * the created user.

Review Comment:
   change to `the updated user`.



-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586#discussion_r901087703


##########
shenyu-admin/src/main/resources/mappers/dashboard-user-sqlmap.xml:
##########
@@ -29,11 +29,11 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        id, 
-        date_created, 
-        date_updated, 
-        user_name, 
-        password, role, 
+        id,
+        date_created,
+        date_updated,
+        user_name,
+        password, role,

Review Comment:
   change to `password,\n
    role,`



-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] codecov-commenter commented on pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586#issuecomment-1159680331

   # [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3586?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3586](https://codecov.io/gh/apache/incubator-shenyu/pull/3586?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ee04dfb) into [master](https://codecov.io/gh/apache/incubator-shenyu/commit/8c097ea98d31c864ca887067ae93f81e40ef4e0a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8c097ea) will **decrease** coverage by `0.67%`.
   > The diff coverage is `51.69%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3586      +/-   ##
   ============================================
   - Coverage     62.58%   61.91%   -0.68%     
   + Complexity     5569     5543      -26     
   ============================================
     Files           848      854       +6     
     Lines         23491    23581      +90     
     Branches       2139     2147       +8     
   ============================================
   - Hits          14703    14600     -103     
   - Misses         7433     7619     +186     
   - Partials       1355     1362       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-shenyu/pull/3586?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../admin/model/event/user/BatchUserDeletedEvent.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZXZlbnQvdXNlci9CYXRjaFVzZXJEZWxldGVkRXZlbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...henyu/admin/model/event/user/UserChangedEvent.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZXZlbnQvdXNlci9Vc2VyQ2hhbmdlZEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...henyu/admin/model/event/user/UserCreatedEvent.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZXZlbnQvdXNlci9Vc2VyQ3JlYXRlZEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...henyu/admin/model/event/user/UserUpdatedEvent.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZXZlbnQvdXNlci9Vc2VyVXBkYXRlZEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../admin/service/impl/DataPermissionServiceImpl.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vc2VydmljZS9pbXBsL0RhdGFQZXJtaXNzaW9uU2VydmljZUltcGwuamF2YQ==) | `72.22% <0.00%> (-1.65%)` | :arrow_down: |
   | [...enyu/admin/service/publish/UserEventPublisher.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vc2VydmljZS9wdWJsaXNoL1VzZXJFdmVudFB1Ymxpc2hlci5qYXZh) | `27.27% <27.27%> (ø)` | |
   | [...u/admin/service/impl/DashboardUserServiceImpl.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vc2VydmljZS9pbXBsL0Rhc2hib2FyZFVzZXJTZXJ2aWNlSW1wbC5qYXZh) | `84.00% <86.11%> (-2.03%)` | :arrow_down: |
   | [...apache/shenyu/admin/model/enums/EventTypeEnum.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZW51bXMvRXZlbnRUeXBlRW51bS5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [...plugin/logging/rocketmq/LoggingRocketMQPlugin.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvTG9nZ2luZ1JvY2tldE1RUGx1Z2luLmphdmE=) | `22.72% <0.00%> (-72.73%)` | :arrow_down: |
   | [...controller/ShenyuClientHttpRegistryController.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vY29udHJvbGxlci9TaGVueXVDbGllbnRIdHRwUmVnaXN0cnlDb250cm9sbGVyLmphdmE=) | `77.77% <0.00%> (-22.23%)` | :arrow_down: |
   | ... and [29 more](https://codecov.io/gh/apache/incubator-shenyu/pull/3586/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3586?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3586?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [8c097ea...ee04dfb](https://codecov.io/gh/apache/incubator-shenyu/pull/3586?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang merged pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
dragon-zhang merged PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586


-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586#discussion_r901088033


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/DashboardUserMapper.java:
##########
@@ -74,6 +74,14 @@ public interface DashboardUserMapper extends ExistProvider {
      */
     List<DashboardUserDO> selectByQuery(DashboardUserQuery dashboardUserQuery);
     
+    /**
+     * select by ids.
+     *
+     * @param ids ids.
+     * @return users
+     */
+    List<DashboardUserDO> selectByIds(@Param("ids") List<String> ids);

Review Comment:
   better change to `List<DashboardUserDO> selectByIds(@Param("ids") Set<String> ids);`



-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586#discussion_r901086994


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/model/event/user/UserChangedEvent.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.event.user;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.model.entity.DashboardUserDO;
+import org.apache.shenyu.admin.model.enums.EventTypeEnum;
+import org.apache.shenyu.admin.model.event.AdminDataModelChangedEvent;
+
+import java.util.Objects;
+
+/**
+ * UserChangedEvent.
+ */
+public class UserChangedEvent extends AdminDataModelChangedEvent {
+    
+    
+    /**
+     * Create a new {@code UserChangedEvent}.operator is unknown.
+     *
+     * @param source Current user state
+     * @param before Before the change user state
+     * @param type   event type
+     */
+    public UserChangedEvent(final DashboardUserDO source, final DashboardUserDO before, final EventTypeEnum type, final String operator) {
+        super(source, before, type, operator);
+    }
+    
+    @Override
+    public String buildContext() {
+        final DashboardUserDO after = (DashboardUserDO) getAfter();
+        if (Objects.isNull(getBefore())) {
+            return String.format("the selector [%s] is %s", after.getUserName(), StringUtils.lowerCase(getType().getType().toString()));
+        }
+        return String.format("the selector [%s] is %s : %s", after.getUserName(), StringUtils.lowerCase(getType().getType().toString()), contrast());
+        
+    }
+    
+    private String contrast() {
+        final DashboardUserDO before = (DashboardUserDO) getBefore();
+        Objects.requireNonNull(before);
+        final DashboardUserDO after = (DashboardUserDO) getAfter();
+        Objects.requireNonNull(after);
+        if (Objects.equals(before, after)) {
+            return "it no change";
+        }
+        final StringBuilder builder = new StringBuilder();
+        if (!Objects.equals(before.getUserName(), after.getUserName())) {
+            builder.append(String.format("name[%s => %s] ", before.getUserName(), after.getUserName()));
+        }
+        if (!Objects.equals(before.getPassword(), after.getPassword())) {
+            builder.append("password is changed...");
+        }
+        if (!Objects.equals(before.getRole(), after.getRole())) {
+            builder.append(String.format("role[%s => %s] ", before.getRole(), after.getRole()));
+        }
+        if (!Objects.equals(before.getEnabled(), after.getEnabled())) {
+            builder.append(String.format("enable[%s => %s] ", before.getEnabled(), after.getEnabled()));
+        }
+
+        return builder.toString();
+    }
+    

Review Comment:
   How about add  a `getChangedUser` ?



-- 
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: notifications-unsubscribe@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3586: [ISSUE #3221]Feature/record log in user

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3586:
URL: https://github.com/apache/incubator-shenyu/pull/3586#discussion_r901087703


##########
shenyu-admin/src/main/resources/mappers/dashboard-user-sqlmap.xml:
##########
@@ -29,11 +29,11 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        id, 
-        date_created, 
-        date_updated, 
-        user_name, 
-        password, role, 
+        id,
+        date_created,
+        date_updated,
+        user_name,
+        password, role,

Review Comment:
   change to `password, 
   role,`



-- 
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: notifications-unsubscribe@shenyu.apache.org

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