#!/bin/bash source $SDK_VERSIONS/testdata/pycipres.conf usage() { echo echo "You must supply username and password of a cipres admin account with -u username and -p password." echo "Note that the Rest Service must be up and running." echo echo "You can delete the accounts with 'userDelete account'. That command will delete" echo "the account, any applications that are owned by that account, and any users that are registered" echo "with the applications." echo exit 1 } if [[ $# < 2 ]] ; then usage fi action=create while [[ $# > 1 ]] do key="$1" shift case $key in -u) AUSER="$1" shift ;; -p) APASS="$1" shift ;; -c) action=create ;; -d) action=delete ;; *) usage ;; esac done if [[ -z $AUSER || -z $APASS ]] ; then usage fi case $action in create) echo "Contacting service at $URL: as cipres admin user: $AUSER" echo "Running : curl -k -u $AUSER:--- $URL/user/$PYCIPRES_ADMIN " echo "Create/update $PYCIPRES_ADMIN User" curl -k -u $AUSER:$APASS $URL/user/$PYCIPRES_ADMIN \ -d role=REST_ADMIN \ -d password=$TESTPASS\ -d email="$PYCIPRES_ADMIN@yahoo.com" \ -d first_name=$PYCIPRES_ADMIN \ -d last_name=$PYCIPRES_ADMIN echo "Create/update $PYCIPRES_APP Application" curl -k -u $AUSER:$APASS $URL/application/$PYCIPRES_ADMIN/$PYCIPRES_APP \ -d longname="pycipres scripts" \ -d authtype=DIRECT \ -d activate=true # This will give error message if user already exists echo "Create/update $PYCIPRES_EU End User" curl -k $URL/user/$PYCIPRES_EU \ -d role=REST_END_USER_DIRECT \ -d password=$TESTPASS\ -d appname=$PYCIPRES_APP \ -d email=$PYCIPRES_EU@yahoo.com \ -d first_name=$PYCIPRES_EU \ -d last_name=$PYCIPRES_EU echo "Create/update $GUIDEMO_ADMIN User" curl -k -u $AUSER:$APASS $URL/user/$GUIDEMO_ADMIN \ -d role=REST_ADMIN \ -d password=$TESTPASS\ -d email="$GUIDEMO_ADMIN@yahoo.com" \ -d first_name=$GUIDEMO_ADMIN \ -d last_name=$GUIDEMO_ADMIN echo "Create/update $GUIDEMO_APP Application" curl -k -u $AUSER:$APASS $URL/application/$GUIDEMO_ADMIN/$GUIDEMO_APP \ -d longname="web application demo" \ -d authtype=UMBRELLA \ -d activate=true ;; delete) echo "not implemented, use userDelete command instead." ;; esac