Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
b4f1193f
Commit
b4f1193f
authored
Apr 17, 2020
by
Robert Czechowski
Committed by
Robert Czechowski
May 14, 2020
Browse files
Admin page: Add link to admin page for admin
parent
8a358ae0
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/core.rs
View file @
b4f1193f
...
...
@@ -49,6 +49,9 @@ fn fill_user_data(session: &SessionUser, data: &mut json_val::Map<String, serde_
if
session
.is_logged_in
()
{
data
.insert
(
"logged_in"
.to_string
(),
to_json
(
&
true
));
}
if
session
.is_admin
()
{
data
.insert
(
"admin"
.to_string
(),
to_json
(
&
true
));
}
data
.insert
(
"username"
.to_string
(),
to_json
(
&
session
.username
));
data
.insert
(
"firstname"
.to_string
(),
to_json
(
&
session
.firstname
));
data
.insert
(
"lastname"
.to_string
(),
to_json
(
&
session
.lastname
));
...
...
src/db_objects.rs
View file @
b4f1193f
...
...
@@ -259,6 +259,10 @@ impl SessionUser {
(
self
.password
.is_some
()
||
self
.logincode
.is_some
()
||
self
.oauth_foreign_id
.is_some
())
&&
self
.is_alive
()
}
pub
fn
is_admin
(
&
self
)
->
bool
{
self
.id
==
1
}
pub
fn
ensure_alive
(
self
)
->
Option
<
Self
>
{
if
self
.is_alive
()
{
Some
(
self
)
...
...
templates/default/admin.hbs
View file @
b4f1193f
...
...
@@ -4,7 +4,7 @@
<p>
<form
action=
"/admin/user/"
method=
"post"
>
Vorname:
<br>
<input
type=
"text"
name=
"firstname"
>
<input
type=
"text"
name=
"firstname"
value=
"%"
>
<br>
Nachname:
<br>
<input
type=
"text"
name=
"lastname"
autofocus
>
...
...
templates/jwinf/base.hbs
View file @
b4f1193f
...
...
@@ -53,6 +53,9 @@
<a
href=
"/group/"
class=
"button is-warning is-small"
>
⚙
Gruppenverwaltung
</a>
<a
href=
"/teacher"
class=
"button is-primary is-small"
>
👨🏫
Lehrer-Informationen
</a>
{{/if}}
{{#if
admin
}}
<a
href=
"/admin/"
class=
"button is-warning is-small"
>
⚙
Administration
</a>
{{/if}}
</div>
</div>
{{/if}}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment