Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
f940698b
Commit
f940698b
authored
3 years ago
by
Martin Mareš
Committed by
Jan Prachař
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Role nyní logujeme pod user_id
Closes
#252
.
parent
ba6e1c22
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
bin/add-role
+3
-3
3 additions, 3 deletions
bin/add-role
db/db.ddl
+1
-1
1 addition, 1 deletion
db/db.ddl
mo/imports.py
+3
-3
3 additions, 3 deletions
mo/imports.py
mo/web/org_users.py
+6
-6
6 additions, 6 deletions
mo/web/org_users.py
with
13 additions
and
13 deletions
bin/add-role
+
3
−
3
View file @
f940698b
...
...
@@ -61,8 +61,8 @@ ur = db.UserRole(
session
.
add
(
ur
)
session
.
flush
()
mo
.
util
.
log
(
db
.
LogType
.
user
_role
,
ur
.
user_
role_
id
,
{
'
action
'
:
'
assigned
'
,
'
new
'
:
db
.
row2dict
(
ur
),
mo
.
util
.
log
(
db
.
LogType
.
user
,
u
se
r
.
user_id
,
{
'
action
'
:
'
new-role
'
,
'
role
'
:
db
.
row2dict
(
ur
),
})
session
.
commit
()
This diff is collapsed.
Click to expand it.
db/db.ddl
+
1
−
1
View file @
f940698b
...
...
@@ -282,7 +282,7 @@ CREATE TYPE log_type AS ENUM (
'contest', -- contests(contest_id)
'participant', -- participants(user_id)
'task', -- tasks(task_id)
'user_role' -- user_roles(user_id)
'user_role' -- user_roles(user_id)
-- momentálně nepoužíváme, změny rolí logujeme pod user_id
);
CREATE TABLE log (
...
...
This diff is collapsed.
Click to expand it.
mo/imports.py
+
3
−
3
View file @
f940698b
...
...
@@ -278,9 +278,9 @@ class Import:
sess
.
flush
()
logger
.
info
(
f
'
Import:
{
role
.
name
.
title
()
}
user=#
{
user
.
user_id
}
place=#
{
place
.
place_id
}
user_role=#
{
ur
.
user_role_id
}
'
)
mo
.
util
.
log
(
type
=
db
.
LogType
.
user
_role
,
what
=
ur
.
user_
role_
id
,
details
=
{
'
action
'
:
'
import
'
,
'
new
'
:
db
.
row2dict
(
ur
)},
type
=
db
.
LogType
.
user
,
what
=
u
se
r
.
user_id
,
details
=
{
'
action
'
:
'
import
-role
'
,
'
role
'
:
db
.
row2dict
(
ur
)},
)
self
.
cnt_new_roles
+=
1
...
...
This diff is collapsed.
Click to expand it.
mo/web/org_users.py
+
6
−
6
View file @
f940698b
...
...
@@ -310,12 +310,12 @@ def org_org(id: int):
sess
.
add
(
new_role
)
sess
.
flush
()
mo
.
util
.
log
(
type
=
db
.
LogType
.
user
_role
,
type
=
db
.
LogType
.
user
,
what
=
id
,
details
=
{
'
action
'
:
'
new
'
,
'
role
'
:
db
.
row2dict
(
new_role
)},
details
=
{
'
action
'
:
'
new
-role
'
,
'
role
'
:
db
.
row2dict
(
new_role
)},
)
sess
.
commit
()
app
.
logger
.
info
(
f
"
New role for user
id
{
id
}
added:
{
db
.
row2dict
(
new_role
)
}
"
)
app
.
logger
.
info
(
f
"
New role for user
#
{
id
}
added:
{
db
.
row2dict
(
new_role
)
}
"
)
flash
(
f
'
Role
"
{
new_role
}
"
úspěšně přidána
'
,
'
success
'
)
return
redirect
(
url_for
(
'
org_user
'
,
id
=
id
))
...
...
@@ -329,12 +329,12 @@ def org_org(id: int):
else
:
sess
.
delete
(
role
)
mo
.
util
.
log
(
type
=
db
.
LogType
.
user
_role
,
type
=
db
.
LogType
.
user
,
what
=
id
,
details
=
{
'
action
'
:
'
delete
'
,
'
role
'
:
db
.
row2dict
(
role
)},
details
=
{
'
action
'
:
'
delete
-role
'
,
'
role
'
:
db
.
row2dict
(
role
)},
)
sess
.
commit
()
app
.
logger
.
info
(
f
"
Role for user
{
id
}
removed:
{
db
.
row2dict
(
role
)
}
"
)
app
.
logger
.
info
(
f
"
Role for user
#
{
id
}
removed:
{
db
.
row2dict
(
role
)
}
"
)
flash
(
f
'
Role
"
{
role
}
"
úspěšně odebrána
'
,
'
success
'
)
return
redirect
(
url_for
(
'
org_user
'
,
id
=
id
))
...
...
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