Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Roman Karwacik
website
Commits
c716b741
Commit
c716b741
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Log edits to changelog and enhance changelog page
parent
76ad54b4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db.py
+2
-0
2 additions, 0 deletions
db.py
server.py
+14
-4
14 additions, 4 deletions
server.py
templates/log.html
+4
-0
4 additions, 0 deletions
templates/log.html
with
20 additions
and
4 deletions
db.py
+
2
−
0
View file @
c716b741
...
...
@@ -99,6 +99,8 @@ def ldapget(user):
conn
=
ldap3
.
Connection
(
'
ldaps://rumo.fsmpi.rwth-aachen.de
'
,
auto_bind
=
True
)
conn
.
search
(
"
ou=users,dc=fsmpi,dc=rwth-aachen,dc=de
"
,
"
(uid=%s)
"
%
user
,
attributes
=
ldap3
.
ALL_ATTRIBUTES
)
if
not
conn
.
entries
:
return
{}
e
=
conn
.
entries
[
0
]
return
{
'
uid
'
:
user
,
'
givenName
'
:
e
.
givenName
.
value
,
'
sn
'
:
e
.
sn
.
value
}
else
:
...
...
This diff is collapsed.
Click to expand it.
server.py
+
14
−
4
View file @
c716b741
...
...
@@ -132,10 +132,15 @@ def login():
if
request
.
method
==
'
GET
'
:
return
render_template
(
'
login.html
'
)
user
,
groups
=
ldapauth
(
request
.
form
.
get
(
'
user
'
),
request
.
form
.
get
(
'
password
'
))
if
user
and
'
users
'
in
groups
:
session
[
'
user
'
]
=
ldapget
(
user
)
else
:
if
not
user
or
not
'
users
'
in
groups
:
flash
(
'
Login fehlgeschlagen!
'
)
return
render_template
(
'
login.html
'
)
session
[
'
user
'
]
=
ldapget
(
user
)
dbuser
=
query
(
'
SELECT * FROM users WHERE name = ?
'
,
user
)
if
not
dbuser
:
query
(
'
INSERT INTO users (name, realname, fsacc, level, calendar_key, rfc6238) VALUES (?, ?, ?, 1,
""
,
""
)
'
,
user
,
session
[
'
user
'
][
'
givenName
'
],
user
)
dbuser
=
query
(
'
SELECT * FROM users WHERE name = ?
'
,
user
)
session
[
'
user
'
][
'
dbid
'
]
=
dbuser
[
0
][
'
id
'
]
return
redirect
(
request
.
values
.
get
(
'
ref
'
,
url_for
(
'
index
'
)))
@app.route
(
'
/logout
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
...
...
@@ -164,6 +169,10 @@ def edit():
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
assert
table
in
tabs
assert
column
in
tabs
[
table
][
2
]
old
=
query
(
'
SELECT %s AS value FROM %s WHERE %s = ?
'
%
(
column
,
table
,
tabs
[
table
][
1
]),
id
)
query
(
'''
INSERT INTO changelog (
"
when
"
, who,
"
table
"
, id_key, id_value, field, value_old, value_new, executed)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1)
'''
,
datetime
.
now
(),
session
[
'
user
'
][
'
dbid
'
],
table
,
tabs
[
table
][
1
],
id
,
column
,
old
[
0
][
'
value
'
],
val
)
query
(
'
UPDATE %s SET %s = ? WHERE %s = ?
'
%
(
tabs
[
table
][
0
],
column
,
tabs
[
table
][
1
]),
val
,
id
)
query
(
'
COMMIT
'
)
...
...
@@ -254,4 +263,5 @@ def stats():
@register_navbar
(
'
Changelog
'
,
'
book
'
)
@mod_required
def
log
():
return
render_template
(
'
log.html
'
,
changelog
=
query
(
'
SELECT * FROM changelog ORDER BY
"
when
"
LIMIT 10
'
))
changelog
=
query
(
'
SELECT * FROM changelog LEFT JOIN users ON (changelog.who = users.id) ORDER BY
"
when
"
DESC LIMIT 10
'
)
return
render_template
(
'
log.html
'
,
changelog
=
changelog
)
This diff is collapsed.
Click to expand it.
templates/log.html
+
4
−
0
View file @
c716b741
...
...
@@ -18,7 +18,11 @@
{% for i in changelog %}
<tr>
<td>
{{i.when}}
</td>
{% if i.realname %}
<td>
{{i.realname}} ({{i.who}})
</td>
{% else %}
<td>
{{i.who}}
</td>
{% endif %}
<td>
{{i.path}}
</td>
<td>
"{{i.value_old}}"
</td>
<td>
"{{i.value_new}}"
</td>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment