[sr-dev] git:master: kamctl: added show command to display user attributes in subscriber table

Daniel-Constantin Mierla miconda at gmail.com
Sat Jun 15 18:24:59 CEST 2013


Module: sip-router
Branch: master
Commit: da016636be6e0ca9a65b645b6e30ec0b1dafeef4
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=da016636be6e0ca9a65b645b6e30ec0b1dafeef4

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jun 14 08:42:37 2013 +0200

kamctl: added show command to display user attributes in subscriber table

---

 utils/kamctl/kamctl      |   26 ++++++++++++++++++++++++++
 utils/kamctl/kamctl.base |    1 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 01c99c9..42d031e 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2151,6 +2151,28 @@ subscriber() {
 			fi
 			;;
 
+		show)
+			if [ $# -ne 2 ] ; then
+				usage_subscriber
+				exit 1
+			fi
+			shift
+
+			set_user $1
+
+			case $DBENGINE in
+				MYSQL|mysql|MySQL)
+					QUERY="SELECT * FROM $SUB_TABLE \
+WHERE $SUBSCRIBER_COLUMN='$OSERUSER' AND $REALM_COLUMN='$OSERDOMAIN'\G"
+				;;
+				*)
+					QUERY="SELECT * FROM $SUB_TABLE \
+WHERE $SUBSCRIBER_COLUMN='$OSERUSER' AND $REALM_COLUMN='$OSERDOMAIN';"
+				;;
+			esac
+			$DBROCMD "$QUERY"
+			;;
+
 		passwd)
 			if [ $# -ne 3 ] ; then
 				usage_subscriber
@@ -2516,6 +2538,10 @@ case $1 in
 		subscriber "$@"
 		;;
 
+	show)
+		subscriber "$@"
+		;;
+
 	passwd)
 		subscriber "$@"
 		;;
diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base
index 589e0a0..034ac51 100644
--- a/utils/kamctl/kamctl.base
+++ b/utils/kamctl/kamctl.base
@@ -422,6 +422,7 @@ usage_subscriber() {
 	echo
 cat <<EOF
  add <username> <password> .......... add a new subscriber (*)
+ show <username> .................... show subscriber attributes (*)
  passwd <username> <passwd> ......... change user's password (*)
  rm <username> ...................... delete a user (*)
 EOF




More information about the sr-dev mailing list