Compare commits

..

5 Commits

Author SHA1 Message Date
TIP Automation User
ad4ac98d1a Chg: update image tag in helm values to v2.7.0-RC5 2022-10-05 02:45:49 +00:00
jaspreetsachdev
6633a23635 Merge pull request #87 from Telecominfraproject/main
Fixes for WIFI-10942
2022-10-04 22:41:15 -04:00
stephb9959
e398d3cf4b Merge remote-tracking branch 'origin/main' 2022-10-04 08:10:32 -07:00
stephb9959
f53cc82df1 https://telecominfraproject.atlassian.net/browse/WIFI-10942
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2022-10-04 08:10:24 -07:00
Johann Hoffmann
3f9edc80e0 Add userRole argument to createuser and createuser_v functions
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-10-04 13:15:30 +02:00
4 changed files with 59 additions and 47 deletions

2
build
View File

@@ -1 +1 @@
22 23

View File

@@ -9,7 +9,7 @@ fullnameOverride: ""
images: images:
owsec: owsec:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
tag: v2.7.0-RC4 tag: v2.7.0-RC5
pullPolicy: Always pullPolicy: Always
# regcred: # regcred:
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io # registry: tip-tip-wlan-cloud-ucentral.jfrog.io

View File

@@ -3075,7 +3075,7 @@ namespace OpenWifi {
private: private:
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_; std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
Poco::ThreadPool Pool_{"x-rest",32,128}; Poco::ThreadPool Pool_{"x-rest",8,128};
RESTAPI_GenericServer Server_; RESTAPI_GenericServer Server_;
RESTAPI_ExtServer() noexcept: RESTAPI_ExtServer() noexcept:
@@ -3209,7 +3209,7 @@ namespace OpenWifi {
const Poco::ThreadPool & Pool() { return Pool_; } const Poco::ThreadPool & Pool() { return Pool_; }
private: private:
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_; std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
Poco::ThreadPool Pool_{"i-rest",32,96}; Poco::ThreadPool Pool_{"i-rest",4,64};
RESTAPI_GenericServer Server_; RESTAPI_GenericServer Server_;
RESTAPI_IntServer() noexcept: RESTAPI_IntServer() noexcept:
@@ -3406,7 +3406,7 @@ namespace OpenWifi {
bool NoBuiltInCrypto_=false; bool NoBuiltInCrypto_=false;
Poco::JWT::Signer Signer_; Poco::JWT::Signer Signer_;
Poco::Logger &Logger_; Poco::Logger &Logger_;
Poco::ThreadPool TimerPool_{"timer:pool",2,16}; Poco::ThreadPool TimerPool_{"timer:pool",2,32};
std::unique_ptr<BusEventManager> BusEventManager_; std::unique_ptr<BusEventManager> BusEventManager_;
}; };
@@ -3602,14 +3602,14 @@ namespace OpenWifi {
FileChannel->setProperty("archive", "timestamp"); FileChannel->setProperty("archive", "timestamp");
FileChannel->setProperty("path", LoggingLocation); FileChannel->setProperty("path", LoggingLocation);
Poco::AutoPtr<Poco::AsyncChannel> Async_File(new Poco::AsyncChannel(FileChannel)); Poco::AutoPtr<Poco::AsyncChannel> Async_File(new Poco::AsyncChannel(FileChannel));
Poco::AutoPtr<Poco::AsyncChannel> Async_Muxer(new Poco::AsyncChannel(LogMuxer())); // Poco::AutoPtr<Poco::AsyncChannel> Async_Muxer(new Poco::AsyncChannel(LogMuxer()));
Poco::AutoPtr<Poco::SplitterChannel> Splitter(new Poco::SplitterChannel); // Poco::AutoPtr<Poco::SplitterChannel> Splitter(new Poco::SplitterChannel);
Splitter->addChannel(Async_File); // Splitter->addChannel(Async_File);
Splitter->addChannel(Async_Muxer); // Splitter->addChannel(Async_Muxer);
Poco::AutoPtr<Poco::PatternFormatter> Formatter(new Poco::PatternFormatter); Poco::AutoPtr<Poco::PatternFormatter> Formatter(new Poco::PatternFormatter);
Formatter->setProperty("pattern", LoggingFormat); Formatter->setProperty("pattern", LoggingFormat);
Poco::AutoPtr<Poco::FormattingChannel> FormattingChannel( Poco::AutoPtr<Poco::FormattingChannel> FormattingChannel(
new Poco::FormattingChannel(Formatter, Splitter)); new Poco::FormattingChannel(Formatter, Async_File));
Poco::Logger::root().setChannel(FormattingChannel); Poco::Logger::root().setChannel(FormattingChannel);
} }
auto Level = Poco::Logger::parseLevel(MicroService::instance().ConfigGetString("logging.level", "debug")); auto Level = Poco::Logger::parseLevel(MicroService::instance().ConfigGetString("logging.level", "debug"));

View File

@@ -179,13 +179,19 @@ getlogo() {
} }
createuser() { createuser() {
payload="{ \"id\": \"0\", \"email\" : \"$1\", \"currentPassword\" : \"$2\", \"changePassword\" : true}" case $3 in
curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/user/0" \ root|admin|subscriber|csr|system|installer|noc|accounting)
-H "Accept: application/json" \ payload="{ \"id\": \"0\", \"email\" : \"$1\", \"currentPassword\" : \"$2\", \"changePassword\" : true, \"userRole\" : \"$3\" }"
-H "Content-Type: application/json" \ curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/user/0" \
-H "Authorization: Bearer ${token}" \ -H "Accept: application/json" \
-d "$payload" > ${result_file} -H "Content-Type: application/json" \
jq < ${result_file} -H "Authorization: Bearer ${token}" \
-d "$payload" > ${result_file}
jq < ${result_file} ;;
*)
echo "Error: userRole has to be one of root|admin|subscriber|csr|system|installer|noc|accounting"
exit 1 ;;
esac
} }
createsub() { createsub() {
@@ -199,13 +205,19 @@ createsub() {
} }
createuser_v() { createuser_v() {
payload="{ \"id\": \"0\", \"email\" : \"$1\", \"currentPassword\" : \"$2\", \"changePassword\" : true}" case $3 in
curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/user/0?email_verification=true" \ root|admin|subscriber|csr|system|installer|noc|accounting)
-H "Accept: application/json" \ payload="{ \"id\": \"0\", \"email\" : \"$1\", \"currentPassword\" : \"$2\", \"changePassword\" : true, \"userRole\" : \"$3\" }"
-H "Content-Type: application/json" \ curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/user/0?email_verification=true" \
-H "Authorization: Bearer ${token}" \ -H "Accept: application/json" \
-d "$payload" > ${result_file} -H "Content-Type: application/json" \
jq < ${result_file} -H "Authorization: Bearer ${token}" \
-d "$payload" > ${result_file}
jq < ${result_file} ;;
*)
echo "Error: userRole has to be one of root|admin|subscriber|csr|system|installer|noc|accounting"
exit 1 ;;
esac
} }
deleteuser() { deleteuser() {
@@ -447,7 +459,7 @@ test_service() {
echo "----------------" echo "----------------"
echo "Create test user" echo "Create test user"
echo "----------------" echo "----------------"
createuser testuser@mail.telecominfraproject.com 'Test123!' createuser testuser@mail.telecominfraproject.com 'Test123!' accounting
check_response $result_file check_response $result_file
USER_ID="$(jq -r '.id' < $result_file)" USER_ID="$(jq -r '.id' < $result_file)"
@@ -481,35 +493,35 @@ help() {
echo echo
echo "Usage: cli <cmd> [args]" echo "Usage: cli <cmd> [args]"
echo echo
echo "listendpoints Get all the system endpoints." echo "listendpoints Get all the system endpoints."
echo "emailtest Generate a forgot Password e-amil to the logged in user." echo "emailtest Generate a forgot Password e-amil to the logged in user."
echo "me Show information about the logged user." echo "me Show information about the logged user."
echo "createuser <email> <password> Create a user with an initial password and force the user to change password." echo "createuser <email> <password> <userrole> Create a user with an initial password and force the user to change password."
echo "createuser_v <email> <password> Same as create user but also force an e-mail verification." echo "createuser_v <email> <password> <userrole> Same as create user but also force an e-mail verification."
echo "deleteuser <user UUID> Delete the user." echo "deleteuser <user UUID> Delete the user."
echo "getuser <user UUID> Get the user information." echo "getuser <user UUID> Get the user information."
echo "listusers List users." echo "listusers List users."
echo "policies List the login and access policies." echo "policies List the login and access policies."
echo "setavatar <user UUID> <filename> Sets the avatar for user to the image in filename." echo "setavatar <user UUID> <filename> Sets the avatar for user to the image in filename."
echo "getavatar <user UUID> Get the avatar for the user." echo "getavatar <user UUID> Get the avatar for the user."
echo "deleteavatar <user UUID> Remove the avatar for a user." echo "deleteavatar <user UUID> Remove the avatar for a user."
echo "sendemail <recipient> <from> Sends a test email to see if the e-mail system is working." echo "sendemail <recipient> <from> Sends a test email to see if the e-mail system is working."
echo "setloglevel <subsystem> <loglevel> Set the log level for s specific subsystem." echo "setloglevel <subsystem> <loglevel> Set the log level for s specific subsystem."
echo "getloglevels Get the current log levels for all subsystems." echo "getloglevels Get the current log levels for all subsystems."
echo "getloglevelnames Get the log level names available." echo "getloglevelnames Get the log level names available."
echo "getsubsystemnames Get the list of subsystems." echo "getsubsystemnames Get the list of subsystems."
echo "systeminfo Get basic system information." echo "systeminfo Get basic system information."
echo "reloadsubsystem <subsystem name> Reload the configuration for a subsystem." echo "reloadsubsystem <subsystem name> Reload the configuration for a subsystem."
echo "test_service Run a set of CLI commands for testing purposes" echo "test_service Run a set of CLI commands for testing purposes"
echo echo
} }
shopt -s nocasematch shopt -s nocasematch
case "$1" in case "$1" in
"createuser") login; createuser "$2" "$3"; logout;; "createuser") login; createuser "$2" "$3" "$4"; logout;;
"createsub") login; createsub "$2" "$3"; logout;; "createsub") login; createsub "$2" "$3"; logout;;
"createuser_v") login; createuser_v "$2" "$3"; logout;; "createuser_v") login; createuser_v "$2" "$3" "$4"; logout;;
"createsub_v") login; createsub_v "$2" "$3"; logout;; "createsub_v") login; createsub_v "$2" "$3"; logout;;
"deleteuser") login; deleteuser "$2" ; logout;; "deleteuser") login; deleteuser "$2" ; logout;;
"deletesub") login; deletesub "$2" ; logout;; "deletesub") login; deletesub "$2" ; logout;;