[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-02-21 Thread Ashadeepa
Github user Ashadeepa closed the pull request at:

https://github.com/apache/cloudstack/pull/1910


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-02-16 Thread Ashadeepa
GitHub user Ashadeepa reopened a pull request:

https://github.com/apache/cloudstack/pull/1910

CLOUDSTACK-9748:VPN Users search functionality broken

VPN Users search functionality broken 
If you try to search VPN users with it’s user name, you will not be able 
to search.

Fixed the same.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Ashadeepa/cloudstack CLOUDSTACK-9748

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/1910.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1910


commit 0752ff667db09eeb3276627baef009eb414abaf4
Author: root 
Date:   2017-01-17T18:09:17Z

CLOUDSTACK-9748:VPN Users search functionality broken




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-02-16 Thread Ashadeepa
Github user Ashadeepa closed the pull request at:

https://github.com/apache/cloudstack/pull/1910


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-30 Thread Ashadeepa
Github user Ashadeepa commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1910#discussion_r98422211
  
--- Diff: server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
---
@@ -596,7 +597,7 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
 
 
 sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.EQ);
+sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.LIKE);
--- End diff --

@ustcweizhou : Thanks but unfortunately, addOr & addAnd methods are now 
deprecated, so I avoided using the same.

Also, LIKE with work only when keyword is set. When only username is set,   
   `sc.setParameters("username", username); `
will get executed with the exact match i.e. same as how EQ will work!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-30 Thread ustcweizhou
Github user ustcweizhou commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1910#discussion_r98412264
  
--- Diff: server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
---
@@ -596,7 +597,7 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
 
 
 sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.EQ);
+sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.LIKE);
--- End diff --

I vote EQ instead LIKE here.
you may add new rules here in the next part, for example.

+if (keyword != null) {
+final SearchCriteria ssc = 
_vpnUsersDao.createSearchCriteria();
+ssc.addOr("username", SearchCriteria.Op.LIKE, "%" + keyword + 
"%");
+ssc.addOr("state", SearchCriteria.Op.EQ, "%" + keyword + "%");
+sc.addAnd("username", SearchCriteria.Op.SC, ssc);
+}




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-29 Thread Ashadeepa
Github user Ashadeepa commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1910#discussion_r98381232
  
--- Diff: server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
---
@@ -596,7 +597,7 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
 
 
 sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.EQ);
+sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.LIKE);
--- End diff --

@syed Used LIKE instead of EQ as username will be used in a WHERE clause to 
search for a specified pattern in a column using the keyword.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-29 Thread Ashadeepa
Github user Ashadeepa commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1910#discussion_r98381118
  
--- Diff: server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
---
@@ -613,6 +614,10 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
 sc.setParameters("username", username);
 }
 
+if (keyword!= null) {
+sc.setParameters("username",  "%" + keyword + "%");
+}
+
 Pair, Integer> result = 
_vpnUsersDao.searchAndCount(sc, searchFilter);
--- End diff --

@syed : If both are set, we are giving preference to keyword as the search 
will happen using keyword query param. This is in according with other existing 
APIs. Keyword is the request parameter for : List by keyword functionality. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-29 Thread syed
Github user syed commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1910#discussion_r98365622
  
--- Diff: server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
---
@@ -596,7 +597,7 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
 
 
 sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.EQ);
+sb.and("username", sb.entity().getUsername(), 
SearchCriteria.Op.LIKE);
--- End diff --

Any reason for changing this to `LIKE` instead of `EQ` ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-29 Thread syed
Github user syed commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1910#discussion_r98365603
  
--- Diff: server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
---
@@ -613,6 +614,10 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
 sc.setParameters("username", username);
 }
 
+if (keyword!= null) {
+sc.setParameters("username",  "%" + keyword + "%");
+}
+
 Pair, Integer> result = 
_vpnUsersDao.searchAndCount(sc, searchFilter);
--- End diff --

What if both username and keyword are set? Shouldn't we prefer the 
username? Also what is `keyword` anyways?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1910: CLOUDSTACK-9748:VPN Users search functionalit...

2017-01-18 Thread Ashadeepa
GitHub user Ashadeepa opened a pull request:

https://github.com/apache/cloudstack/pull/1910

CLOUDSTACK-9748:VPN Users search functionality broken

VPN Users search functionality broken 
If you try to search VPN users with it’s user name, you will not be able 
to search.

Fixed the same.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Ashadeepa/cloudstack CLOUDSTACK-9748

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/1910.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1910


commit 0752ff667db09eeb3276627baef009eb414abaf4
Author: root 
Date:   2017-01-17T18:09:17Z

CLOUDSTACK-9748:VPN Users search functionality broken




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---