mirror of
https://git.unistra.fr/aius/root/ldap-overleaf-sl.git
synced 2025-05-04 11:45:26 +02:00
Fixed Issue #7. Other solution for pull request #8 - it is now selectable which admin interface is used (via .env file)
This commit is contained in:
parent
90e7681c35
commit
57da632558
6 changed files with 91 additions and 4 deletions
1
.env
1
.env
|
@ -4,3 +4,4 @@ MYMAIL=MYEMAIL@MYDOMAIN.TLD
|
||||||
MYDATA=/data
|
MYDATA=/data
|
||||||
LOGIN_TEXT=username
|
LOGIN_TEXT=username
|
||||||
COLLAB_TEXT=Direct share with collaborators is enabled only for activated users!
|
COLLAB_TEXT=Direct share with collaborators is enabled only for activated users!
|
||||||
|
ADMIN_IS_SYSADMIN=false
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -3,6 +3,7 @@ include .env
|
||||||
build:
|
build:
|
||||||
docker build --build-arg login_text="${LOGIN_TEXT}" \
|
docker build --build-arg login_text="${LOGIN_TEXT}" \
|
||||||
--build-arg collab_text="${COLLAB_TEXT}" \
|
--build-arg collab_text="${COLLAB_TEXT}" \
|
||||||
|
--build-arg admin_is_sysadmin="${ADMIN_IS_SYSADMIN}" \
|
||||||
-t "ldap-overleaf-sl" ldap-overleaf-sl
|
-t "ldap-overleaf-sl" ldap-overleaf-sl
|
||||||
|
|
||||||
clean: check_clean
|
clean: check_clean
|
||||||
|
|
|
@ -63,9 +63,11 @@ MYDATA=/data
|
||||||
```
|
```
|
||||||
LOGIN_TEXT=username
|
LOGIN_TEXT=username
|
||||||
COLLAB_TEXT=Direct share with collaborators is enabled only for activated users!
|
COLLAB_TEXT=Direct share with collaborators is enabled only for activated users!
|
||||||
|
ADMIN_IS_SYSADMIN=false
|
||||||
```
|
```
|
||||||
*LOGIN_TEXT* : displayed instead of email-adress field (login.pug) <br/>
|
*LOGIN_TEXT* : displayed instead of email-adress field (login.pug) <br/>
|
||||||
*COLLAB_TEXT* : displayed for email invitation (share.pug)
|
*COLLAB_TEXT* : displayed for email invitation (share.pug)<br/>
|
||||||
|
*ADMIN_IS_SYSADMIN* : false or true (if ``false`` isAdmin group is allowed to add users to sharelatex and post messages. if ``true`` isAdmin group is allowed to logout other users / set maintenance mode)
|
||||||
|
|
||||||
|
|
||||||
### LDAP Configuration
|
### LDAP Configuration
|
||||||
|
|
|
@ -8,6 +8,7 @@ LABEL version="0.1"
|
||||||
# passed from .env (via make)
|
# passed from .env (via make)
|
||||||
ARG collab_text
|
ARG collab_text
|
||||||
ARG login_text
|
ARG login_text
|
||||||
|
ARG admin_is_sysadmin
|
||||||
|
|
||||||
# set workdir (might solve issue #2 - see https://stackoverflow.com/questions/57534295/)
|
# set workdir (might solve issue #2 - see https://stackoverflow.com/questions/57534295/)
|
||||||
WORKDIR /var/www/sharelatex/web
|
WORKDIR /var/www/sharelatex/web
|
||||||
|
@ -50,6 +51,9 @@ COPY sharelatex/navbar.pug /var/www/sharelatex/web/app/views/layout/
|
||||||
|
|
||||||
# Non LDAP User Registration for Admins
|
# Non LDAP User Registration for Admins
|
||||||
COPY sharelatex/admin-index.pug /var/www/sharelatex/web/app/views/admin/index.pug
|
COPY sharelatex/admin-index.pug /var/www/sharelatex/web/app/views/admin/index.pug
|
||||||
|
COPY sharelatex/admin-sysadmin.pug /tmp/admin-sysadmin.pug
|
||||||
|
RUN if [ "${admin_is_sysadmin}" = "true" ] ; then cp /tmp/admin-sysadmin.pug /var/www/sharelatex/web/app/views/admin/index.pug ; else rm /tmp/admin-sysadmin.pug ; fi
|
||||||
|
|
||||||
RUN rm /var/www/sharelatex/web/app/views/admin/register.pug
|
RUN rm /var/www/sharelatex/web/app/views/admin/register.pug
|
||||||
|
|
||||||
### To remove comments entirly (bug https://github.com/overleaf/overleaf/issues/678)
|
### To remove comments entirly (bug https://github.com/overleaf/overleaf/issues/678)
|
||||||
|
|
|
@ -306,8 +306,8 @@ const AuthenticationManager = {
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("An Error occured while getting user data during ldapsearch: " + String(ex))
|
console.log("An Error occured while getting user data during ldapsearch: " + String(ex))
|
||||||
await client.unbind();
|
await client.unbind();
|
||||||
return callback(null, null)
|
return callback(null, null)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// if admin filter is set - only set admin for user in ldap group
|
// if admin filter is set - only set admin for user in ldap group
|
||||||
|
|
79
ldap-overleaf-sl/sharelatex/admin-sysadmin.pug
Normal file
79
ldap-overleaf-sl/sharelatex/admin-sysadmin.pug
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
extends ../layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
.content.content-alt
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-xs-12
|
||||||
|
.card(ng-controller="RegisterUsersController")
|
||||||
|
.page-header
|
||||||
|
h1 Admin Panel
|
||||||
|
tabset(ng-cloak)
|
||||||
|
tab(heading="System Messages")
|
||||||
|
each message in systemMessages
|
||||||
|
.alert.alert-info.row-spaced(ng-non-bindable) #{message.content}
|
||||||
|
hr
|
||||||
|
form(method='post', action='/admin/messages')
|
||||||
|
input(name="_csrf", type="hidden", value=csrfToken)
|
||||||
|
.form-group
|
||||||
|
label(for="content")
|
||||||
|
input.form-control(name="content", type="text", placeholder="Message...", required)
|
||||||
|
button.btn.btn-primary(type="submit") Post Message
|
||||||
|
hr
|
||||||
|
form(method='post', action='/admin/messages/clear')
|
||||||
|
input(name="_csrf", type="hidden", value=csrfToken)
|
||||||
|
button.btn.btn-danger(type="submit") Clear all messages
|
||||||
|
|
||||||
|
|
||||||
|
tab(heading="Register non LDAP User")
|
||||||
|
form.form
|
||||||
|
.row
|
||||||
|
.col-md-4.col-xs-8
|
||||||
|
input.form-control(
|
||||||
|
name="email",
|
||||||
|
type="text",
|
||||||
|
placeholder="jane@example.com, joe@example.com",
|
||||||
|
ng-model="inputs.emails",
|
||||||
|
on-enter="registerUsers()"
|
||||||
|
)
|
||||||
|
.col-md-8.col-xs-4
|
||||||
|
button.btn.btn-primary(ng-click="registerUsers()") #{translate("register")}
|
||||||
|
|
||||||
|
.row-spaced(ng-show="error").ng-cloak.text-danger
|
||||||
|
p Sorry, an error occured
|
||||||
|
|
||||||
|
.row-spaced(ng-show="users.length > 0").ng-cloak.text-success
|
||||||
|
p We've sent out welcome emails to the registered users.
|
||||||
|
p You can also manually send them URLs below to allow them to reset their password and log in for the first time.
|
||||||
|
p (Password reset tokens will expire after one week and the user will need registering again).
|
||||||
|
|
||||||
|
hr(ng-show="users.length > 0").ng-cloak
|
||||||
|
table(ng-show="users.length > 0").table.table-striped.ng-cloak
|
||||||
|
tr
|
||||||
|
th #{translate("email")}
|
||||||
|
th Set Password Url
|
||||||
|
tr(ng-repeat="user in users")
|
||||||
|
td {{ user.email }}
|
||||||
|
td(style="word-break: break-all;") {{ user.setNewPasswordUrl }}
|
||||||
|
tab(heading="Open/Close Editor" bookmarkable-tab="open-close-editor")
|
||||||
|
if hasFeature('saas')
|
||||||
|
| The "Open/Close Editor" feature is not available in SAAS.
|
||||||
|
else
|
||||||
|
.row-spaced
|
||||||
|
form(method='post',action='/admin/closeEditor')
|
||||||
|
input(name="_csrf", type="hidden", value=csrfToken)
|
||||||
|
button.btn.btn-danger(type="submit") Close Editor
|
||||||
|
p.small Will stop anyone opening the editor. Will NOT disconnect already connected users.
|
||||||
|
|
||||||
|
.row-spaced
|
||||||
|
form(method='post',action='/admin/disconnectAllUsers')
|
||||||
|
input(name="_csrf", type="hidden", value=csrfToken)
|
||||||
|
button.btn.btn-danger(type="submit") Disconnect all users
|
||||||
|
p.small Will force disconnect all users with the editor open. Make sure to close the editor first to avoid them reconnecting.
|
||||||
|
|
||||||
|
.row-spaced
|
||||||
|
form(method='post',action='/admin/openEditor')
|
||||||
|
input(name="_csrf", type="hidden", value=csrfToken)
|
||||||
|
button.btn.btn-danger(type="submit") Reopen Editor
|
||||||
|
p.small Will reopen the editor after closing.
|
||||||
|
|
Loading…
Add table
Reference in a new issue