Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Add support for admin status sync](wekan/ldap#40).
Examples: LDAP_SYNC_ADMIN_STATUS=true, LDAP_SYNC_ADMIN_GROUP=group1,group2

Thanks to JulianJacobi and xet7 !
  • Loading branch information
xet7 committed Mar 6, 2019
1 parent a024b6d commit 7e451d9
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 17 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Expand Up @@ -75,6 +75,8 @@ ARG LDAP_SYNC_USER_DATA
ARG LDAP_SYNC_USER_DATA_FIELDMAP
ARG LDAP_SYNC_GROUP_ROLES
ARG LDAP_DEFAULT_DOMAIN
ARG LDAP_SYNC_ADMIN_STATUS
ARG LDAP_SYNC_ADMIN_GROUPS
ARG LOGOUT_WITH_TIMER
ARG LOGOUT_IN
ARG LOGOUT_ON_HOURS
Expand Down Expand Up @@ -159,6 +161,8 @@ ENV BUILD_DEPS="apt-utils bsdtar gnupg gosu wget curl bzip2 build-essential pyth
LDAP_SYNC_USER_DATA_FIELDMAP="" \
LDAP_SYNC_GROUP_ROLES="" \
LDAP_DEFAULT_DOMAIN="" \
LDAP_SYNC_ADMIN_STATUS="" \
LDAP_SYNC_ADMIN_GROUPS="" \
LOGOUT_WITH_TIMER=false \
LOGOUT_IN="" \
LOGOUT_ON_HOURS="" \
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Expand Up @@ -501,6 +501,12 @@ services:
# LDAP_DEFAULT_DOMAIN : The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP
# example :
#- LDAP_DEFAULT_DOMAIN=
#
# Enable/Disable syncing of admin status based on ldap groups:
#- LDAP_SYNC_ADMIN_STATUS=true
#
# Comma separated list of admin group names to sync.
#- LDAP_SYNC_ADMIN_GROUPS=group1,group2
#---------------------------------------------------------------------
# ==== LOGOUT TIMER, probably does not work yet ====
# LOGOUT_WITH_TIMER : Enables or not the option logout with timer
Expand Down
4 changes: 4 additions & 0 deletions releases/virtualbox/start-wekan.sh
Expand Up @@ -247,6 +247,10 @@
# LDAP_DEFAULT_DOMAIN : The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP
# example :
#export LDAP_DEFAULT_DOMAIN=
# Enable/Disable syncing of admin status based on ldap groups:
#export LDAP_SYNC_ADMIN_STATUS=true
# Comma separated list of admin group names.
#export LDAP_SYNC_ADMIN_GROUPS=group1,group2
# LOGOUT_WITH_TIMER : Enables or not the option logout with timer
# example : LOGOUT_WITH_TIMER=true
#export LOGOUT_WITH_TIMER=
Expand Down
10 changes: 9 additions & 1 deletion snap-src/bin/config
Expand Up @@ -3,7 +3,7 @@
# All supported keys are defined here together with descriptions and default values

# list of supported keys
keys="DEBUG MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB CADDY_ENABLED CADDY_BIND_PORT WITH_API EMAIL_NOTIFICATION_TIMEOUT CORS MATOMO_ADDRESS MATOMO_SITE_ID MATOMO_DO_NOT_TRACK MATOMO_WITH_USERNAME BROWSER_POLICY_ENABLED TRUSTED_URL WEBHOOKS_ATTRIBUTES OAUTH2_ENABLED OAUTH2_CLIENT_ID OAUTH2_SECRET OAUTH2_SERVER_URL OAUTH2_AUTH_ENDPOINT OAUTH2_USERINFO_ENDPOINT OAUTH2_TOKEN_ENDPOINT OAUTH2_ID_MAP OAUTH2_USERNAME_MAP OAUTH2_FULLNAME_MAP OAUTH2_EMAIL_MAP LDAP_ENABLE LDAP_PORT LDAP_HOST LDAP_BASEDN LDAP_LOGIN_FALLBACK LDAP_RECONNECT LDAP_TIMEOUT LDAP_IDLE_TIMEOUT LDAP_CONNECT_TIMEOUT LDAP_AUTHENTIFICATION LDAP_AUTHENTIFICATION_USERDN LDAP_AUTHENTIFICATION_PASSWORD LDAP_LOG_ENABLED LDAP_BACKGROUND_SYNC LDAP_BACKGROUND_SYNC_INTERVAL LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS LDAP_ENCRYPTION LDAP_CA_CERT LDAP_REJECT_UNAUTHORIZED LDAP_USER_SEARCH_FILTER LDAP_USER_SEARCH_SCOPE LDAP_USER_SEARCH_FIELD LDAP_SEARCH_PAGE_SIZE LDAP_SEARCH_SIZE_LIMIT LDAP_GROUP_FILTER_ENABLE LDAP_GROUP_FILTER_OBJECTCLASS LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_FORMAT LDAP_GROUP_FILTER_GROUP_NAME LDAP_UNIQUE_IDENTIFIER_FIELD LDAP_UTF8_NAMES_SLUGIFY LDAP_USERNAME_FIELD LDAP_FULLNAME_FIELD LDAP_MERGE_EXISTING_USERS LDAP_SYNC_USER_DATA LDAP_SYNC_USER_DATA_FIELDMAP LDAP_SYNC_GROUP_ROLES LDAP_DEFAULT_DOMAIN LDAP_EMAIL_MATCH_ENABLE LDAP_EMAIL_MATCH_REQUIRE LDAP_EMAIL_MATCH_VERIFIED LDAP_EMAIL_FIELD LOGOUT_WITH_TIMER LOGOUT_IN LOGOUT_ON_HOURS LOGOUT_ON_MINUTES DEFAULT_AUTHENTICATION_METHOD"
keys="DEBUG MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB CADDY_ENABLED CADDY_BIND_PORT WITH_API EMAIL_NOTIFICATION_TIMEOUT CORS MATOMO_ADDRESS MATOMO_SITE_ID MATOMO_DO_NOT_TRACK MATOMO_WITH_USERNAME BROWSER_POLICY_ENABLED TRUSTED_URL WEBHOOKS_ATTRIBUTES OAUTH2_ENABLED OAUTH2_CLIENT_ID OAUTH2_SECRET OAUTH2_SERVER_URL OAUTH2_AUTH_ENDPOINT OAUTH2_USERINFO_ENDPOINT OAUTH2_TOKEN_ENDPOINT OAUTH2_ID_MAP OAUTH2_USERNAME_MAP OAUTH2_FULLNAME_MAP OAUTH2_EMAIL_MAP LDAP_ENABLE LDAP_PORT LDAP_HOST LDAP_BASEDN LDAP_LOGIN_FALLBACK LDAP_RECONNECT LDAP_TIMEOUT LDAP_IDLE_TIMEOUT LDAP_CONNECT_TIMEOUT LDAP_AUTHENTIFICATION LDAP_AUTHENTIFICATION_USERDN LDAP_AUTHENTIFICATION_PASSWORD LDAP_LOG_ENABLED LDAP_BACKGROUND_SYNC LDAP_BACKGROUND_SYNC_INTERVAL LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS LDAP_ENCRYPTION LDAP_CA_CERT LDAP_REJECT_UNAUTHORIZED LDAP_USER_SEARCH_FILTER LDAP_USER_SEARCH_SCOPE LDAP_USER_SEARCH_FIELD LDAP_SEARCH_PAGE_SIZE LDAP_SEARCH_SIZE_LIMIT LDAP_GROUP_FILTER_ENABLE LDAP_GROUP_FILTER_OBJECTCLASS LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_FORMAT LDAP_GROUP_FILTER_GROUP_NAME LDAP_UNIQUE_IDENTIFIER_FIELD LDAP_UTF8_NAMES_SLUGIFY LDAP_USERNAME_FIELD LDAP_FULLNAME_FIELD LDAP_MERGE_EXISTING_USERS LDAP_SYNC_USER_DATA LDAP_SYNC_USER_DATA_FIELDMAP LDAP_SYNC_GROUP_ROLES LDAP_DEFAULT_DOMAIN LDAP_EMAIL_MATCH_ENABLE LDAP_EMAIL_MATCH_REQUIRE LDAP_EMAIL_MATCH_VERIFIED LDAP_EMAIL_FIELD LDAP_SYNC_ADMIN_STATUS LDAP_SYNC_ADMIN_GROUPS LOGOUT_WITH_TIMER LOGOUT_IN LOGOUT_ON_HOURS LOGOUT_ON_MINUTES DEFAULT_AUTHENTICATION_METHOD"

# default values
DESCRIPTION_DEBUG="Debug OIDC OAuth2 etc. Example: sudo snap set wekan debug='true'"
Expand Down Expand Up @@ -314,6 +314,14 @@ DESCRIPTION_LDAP_SYNC_GROUP_ROLES="ldap-sync-group-roles . Default: '' (empty)."
DEFAULT_LDAP_SYNC_GROUP_ROLES=""
KEY_LDAP_SYNC_GROUP_ROLES="ldap-sync-group-roles"

DESCRIPTION_LDAP_SYNC_ADMIN_STATUS="Enable/Disable syncing of admin status based on LDAP groups. Example: true"
DEFAULT_LDAP_SYNC_ADMIN_STATUS=""
KEY_LDAP_SYNC_ADMIN_STATUS="ldap-sync-admin-status"

DESCRIPTION_LDAP_SYNC_ADMIN_GROUPS="Comma separated list of admin group names to sync. Example: group1, group2"
DEFAULT_LDAP_SYNC_ADMIN_GROUPS=""
KEY_LDAP_SYNC_ADMIN_GROUPS="ldap-sync-admin-groups"

DESCRIPTION_LDAP_DEFAULT_DOMAIN="The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP"
DEFAULT_LDAP_DEFAULT_DOMAIN=""
KEY_LDAP_DEFAULT_DOMAIN="ldap-default-domain"
Expand Down
38 changes: 22 additions & 16 deletions snap-src/bin/wekan-help
Expand Up @@ -297,22 +297,28 @@ echo -e "Ldap Default Domain."
echo -e "The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP:"
echo -e "\t$ snap set $SNAP_NAME ldap-default-domain=''"
echo -e "\n"
# echo -e "Logout with timer."
# echo -e "Enable or not the option that allows to disconnect an user after a given time:"
# echo -e "\t$ snap set $SNAP_NAME logout-with-timer='true'"
# echo -e "\n"
# echo -e "Logout in."
# echo -e "Logout in how many days:"
# echo -e "\t$ snap set $SNAP_NAME logout-in='1'"
# echo -e "\n"
# echo -e "Logout on hours."
# echo -e "Logout in how many hours:"
# echo -e "\t$ snap set $SNAP_NAME logout-on-hours='9'"
# echo -e "\n"
# echo -e "Logout on minutes."
# echo -e "Logout in how many minutes:"
# echo -e "\t$ snap set $SNAP_NAME logout-on-minutes='5'"
# echo -e "\n"
echo -e "Enable/Disable syncing of admin status based on LDAP groups."
echo -e "\t$ snap set $SNAP_NAME ldap-sync-admin-status='true'"
echo -e "\n"
echo -e "Comma separated list of admin group names to sync."
echo -e "\t$ snap set $SNAP_NAME ldap-sync-admin-groups='group1,group2'"
echo -e "\n"
echo -e "Logout with timer."
echo -e "Enable or not the option that allows to disconnect an user after a given time:"
echo -e "\t$ snap set $SNAP_NAME logout-with-timer='true'"
echo -e "\n"
echo -e "Logout in."
echo -e "Logout in how many days:"
echo -e "\t$ snap set $SNAP_NAME logout-in='1'"
echo -e "\n"
echo -e "Logout on hours."
echo -e "Logout in how many hours:"
echo -e "\t$ snap set $SNAP_NAME logout-on-hours='9'"
echo -e "\n"
echo -e "Logout on minutes."
echo -e "Logout in how many minutes:"
echo -e "\t$ snap set $SNAP_NAME logout-on-minutes='5'"
echo -e "\n"
echo -e "Default authentication method."
echo -e "The default authentication method used if a user does not exist to create and authenticate. Method can be password or ldap."
echo -e "\t$ snap set $SNAP_NAME default-authentication-method='ldap'"
Expand Down
6 changes: 6 additions & 0 deletions start-wekan.bat
Expand Up @@ -248,6 +248,12 @@ REM # LDAP_DEFAULT_DOMAIN : The default domain of the ldap it is used to create
REM # example :
REM SET LDAP_DEFAULT_DOMAIN=

REM # Enable/Disable syncing of admin status based on ldap groups:
REM SET LDAP_SYNC_ADMIN_STATUS=true

REM # Comma separated list of admin group names to sync.
REM SET LDAP_SYNC_ADMIN_GROUPS=group1,group2

REM ------------------------------------------------

REM # LOGOUT_WITH_TIMER : Enables or not the option logout with timer
Expand Down
4 changes: 4 additions & 0 deletions start-wekan.sh
Expand Up @@ -265,6 +265,10 @@ function wekan_repo_check(){
# LDAP_DEFAULT_DOMAIN : The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP
# example :
#export LDAP_DEFAULT_DOMAIN=
# Enable/Disable syncing of admin status based on ldap groups:
#export LDAP_SYNC_ADMIN_STATUS=true
# Comma separated list of admin group names to sync.
#export LDAP_SYNC_ADMIN_GROUPS=group1,group2
# LOGOUT_WITH_TIMER : Enables or not the option logout with timer
# example : LOGOUT_WITH_TIMER=true
#export LOGOUT_WITH_TIMER=
Expand Down

0 comments on commit 7e451d9

Please sign in to comment.