mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-12 23:35:50 +00:00
update login-server build, allow create user without group
This commit is contained in:
parent
6101780d42
commit
db15f9c438
@ -32,14 +32,30 @@ services:
|
||||
- SYS_PTRACE
|
||||
volumes:
|
||||
- ./logs:/var/log/grd_login
|
||||
- ./login_server/src:/code/src
|
||||
- ./configs/login_server:/etc/grd_login
|
||||
- login_build:/code/build
|
||||
- conan:/root/.conan
|
||||
|
||||
|
||||
#########################################################
|
||||
## COMMUNITY SERVER (cakephp with php-fpm) ##############
|
||||
#########################################################
|
||||
#community-server:
|
||||
# volumes:
|
||||
# - ./community_server
|
||||
community-server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./community_server/Dockerfile
|
||||
environment:
|
||||
- DB_PASSWORD=''
|
||||
- DB_USER='root'
|
||||
- DB_DATABASE='gradido_community'
|
||||
depends_on:
|
||||
- mariadb
|
||||
networks:
|
||||
- internal-net
|
||||
volumes:
|
||||
- ./community_server/config/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini
|
||||
- ./community_server/src:/var/www/cakephp/src
|
||||
|
||||
|
||||
#########################################################
|
||||
@ -84,5 +100,6 @@ services:
|
||||
|
||||
volumes:
|
||||
frontend_node_modules:
|
||||
login_build:
|
||||
conan:
|
||||
|
||||
|
||||
@ -65,7 +65,6 @@ services:
|
||||
- 1201:1201
|
||||
volumes:
|
||||
- ./configs/login_server:/etc/grd_login
|
||||
- login_build:/code/build_vol
|
||||
|
||||
#########################################################
|
||||
## NGINX ################################################
|
||||
@ -131,4 +130,4 @@ networks:
|
||||
|
||||
volumes:
|
||||
db_vol:
|
||||
login_build:
|
||||
|
||||
|
||||
@ -96,6 +96,7 @@ with:
|
||||
"first_name":"Max",
|
||||
"last_name":"Musterman" ,
|
||||
"emailType": 2,
|
||||
"group_id": 1,
|
||||
"password":"123abcDE&",
|
||||
"login_after_register":true
|
||||
}
|
||||
@ -104,6 +105,7 @@ with:
|
||||
- `emailType`: control email-text sended with email verification code
|
||||
- 2: default, if user has registered directly
|
||||
- 5: if user was registered by an admin
|
||||
- `group_id`: group id of group to which user will join (id from login_server)
|
||||
- `login_after_register`: if set to true auto-login after create user was successfull, means session cookie is set and session_id returned
|
||||
|
||||
### Response
|
||||
|
||||
@ -1,42 +1,32 @@
|
||||
|
||||
#########################################################################################################
|
||||
# Build debug
|
||||
# debug build preparation
|
||||
#########################################################################################################
|
||||
From gradido/login_dependencies:stage2 as debug
|
||||
|
||||
ENV DOCKER_WORKDIR="/code"
|
||||
|
||||
From conanio/gcc9 as build_debug_preparation
|
||||
USER root
|
||||
|
||||
ENV DOCKER_WORKDIR="/code"
|
||||
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
COPY . .
|
||||
|
||||
RUN chmod +x unix_parse_proto.sh
|
||||
RUN chmod +x compile_pot.sh
|
||||
|
||||
RUN ./compile_pot.sh
|
||||
RUN ./unix_parse_proto.sh
|
||||
COPY . .
|
||||
|
||||
RUN cd dependencies/mariadb-connector-c && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=OFF ..
|
||||
|
||||
#########################################################################################################
|
||||
# run debug
|
||||
#########################################################################################################
|
||||
FROM debug as login_server_debug
|
||||
FROM build_debug_preparation as login_server_debug
|
||||
|
||||
ENV DOCKER_WORKDIR="/code"
|
||||
#RUN apt-get update && \
|
||||
# apt-get install -y --no-install-recommends gdb && \
|
||||
# apt-get autoclean && \
|
||||
# apt-get autoremove && \
|
||||
# apt-get clean && \
|
||||
# rm -rf /var/lib/apt/lists/*
|
||||
|
||||
VOLUME /var/log/grd_login
|
||||
VOLUME /code/src
|
||||
|
||||
EXPOSE 1200
|
||||
EXPOSE 1201
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
RUN chmod +x ./Dockerfiles/build_and_run.sh
|
||||
|
||||
CMD ./Dockerfiles/build_and_run.sh; ./build_vol/bin/Gradido_LoginServer
|
||||
CMD ./Dockerfiles/build_and_run.sh; ./build/bin/Gradido_LoginServer
|
||||
|
||||
@ -1,7 +1,21 @@
|
||||
#!/bin/bash
|
||||
cp build/conan* build_vol/
|
||||
cd build_vol
|
||||
|
||||
cd build
|
||||
conan install .. --build=missing -s build_type=Debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
make -j${CPU_COUNT} protoc grpc_cpp_plugin
|
||||
cd ..
|
||||
|
||||
if [ ! -d "./src/cpp/proto/hedera" ] ; then
|
||||
#if [ ! -f "./src/cpp/proto/gradido/TransactionBody.pb.h"] ; then
|
||||
chmod +x unix_parse_proto.sh
|
||||
./unix_parse_proto.sh
|
||||
fi
|
||||
chmod +x compile_pot.sh
|
||||
|
||||
./compile_pot.sh
|
||||
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
make -j$(nproc) Gradido_LoginServer
|
||||
#echo "building done"
|
||||
|
||||
@ -17,11 +17,12 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
||||
std::string password;
|
||||
bool login_after_register = false;
|
||||
int emailType;
|
||||
int group_id;
|
||||
int group_id = 1;
|
||||
bool group_was_not_set = false;
|
||||
|
||||
auto em = EmailManager::getInstance();
|
||||
auto sm = SessionManager::getInstance();
|
||||
|
||||
printf("enter\n");
|
||||
// if is json object
|
||||
if (params.type() == typeid(Poco::JSON::Object::Ptr)) {
|
||||
Poco::JSON::Object::Ptr paramJsonObject = params.extract<Poco::JSON::Object::Ptr>();
|
||||
@ -35,7 +36,11 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
||||
paramJsonObject->get("first_name").convert(first_name);
|
||||
paramJsonObject->get("last_name").convert(last_name);
|
||||
paramJsonObject->get("emailType").convert(emailType);
|
||||
paramJsonObject->get("group_id").convert(group_id);
|
||||
auto group_id_obj = paramJsonObject->get("group_id");
|
||||
|
||||
if(!group_id_obj.isEmpty()) {
|
||||
group_id_obj.convert(group_id);
|
||||
}
|
||||
|
||||
if ((ServerConfig::g_AllowUnsecureFlags & ServerConfig::UNSECURE_PASSWORD_REQUESTS)) {
|
||||
paramJsonObject->get("password").convert(password);
|
||||
@ -75,6 +80,10 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
||||
}
|
||||
|
||||
// create user
|
||||
if(!group_id) {
|
||||
group_id = 1;
|
||||
group_was_not_set = true;
|
||||
}
|
||||
user = controller::User::create(email, first_name, last_name, group_id);
|
||||
auto userModel = user->getModel();
|
||||
Session* session = nullptr;
|
||||
@ -93,7 +102,7 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
||||
UniLib::controller::TaskPtr create_authenticated_encrypten_key = new AuthenticatedEncryptionCreateKeyTask(user, password);
|
||||
create_authenticated_encrypten_key->scheduleTask(create_authenticated_encrypten_key);
|
||||
}
|
||||
|
||||
|
||||
auto emailOptIn = controller::EmailVerificationCode::create(userModel->getID(), model::table::EMAIL_OPT_IN_REGISTER);
|
||||
auto emailOptInModel = emailOptIn->getModel();
|
||||
if (!emailOptInModel->insertIntoDB(false)) {
|
||||
@ -105,10 +114,14 @@ Poco::JSON::Object* JsonCreateUser::handle(Poco::Dynamic::Var params)
|
||||
|
||||
if (login_after_register && session) {
|
||||
Poco::JSON::Object* result = stateSuccess();
|
||||
|
||||
if(group_was_not_set) {
|
||||
Poco::JSON::Array infos;
|
||||
infos.add("group_id was not set, use 1 as default!");
|
||||
result->set("info", infos);
|
||||
}
|
||||
result->set("session_id", session->getHandle());
|
||||
return result;
|
||||
}
|
||||
|
||||
return stateSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user