Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
88d80fef
Commit
88d80fef
authored
Mar 12, 2012
by
Enrico Zini
Browse files
Check that permissions in NM correspond with django
parent
2308c5df
Changes
1
Hide whitespace changes
Inline
Side-by-side
maintenance/management/commands/maintenance.py
View file @
88d80fef
...
...
@@ -211,6 +211,30 @@ class Checker(object):
if
person
.
status
not
in
(
const
.
STATUS_DD_U
,
const
.
STATUS_DD_NU
):
log
.
warning
(
"%s has gidNumber 800 but the db has state %s"
,
repr
(
person
),
person
.
status
)
def
check_django_permissions
(
self
,
**
kw
):
from
django.contrib.auth.models
import
User
from
django.db.models
import
Q
# Get the list of users that django thinks are powerful
django_power_users
=
set
()
for
u
in
User
.
objects
.
all
():
if
u
.
is_staff
or
u
.
is_superuser
:
django_power_users
.
add
(
u
.
id
)
# Get the list of users that we think are powerful
nm_power_users
=
set
()
for
a
in
bmodels
.
AM
.
objects
.
filter
(
Q
(
is_fd
=
True
)
|
Q
(
is_dam
=
True
)):
if
a
.
person
.
user
is
None
:
log
.
warning
(
"Person %s has no corresponding django user"
,
a
.
person
)
else
:
nm_power_users
.
add
(
a
.
person
.
user
.
id
)
for
id
in
(
django_power_users
-
nm_power_users
):
log
.
warning
(
"auth.models.User.id %d has powers that the NM site does not know about"
,
id
)
for
id
in
(
nm_power_users
-
django_power_users
):
log
.
warning
(
"auth.models.User.id %d has powers in NM that django does not know about"
,
id
)
def
run
(
self
,
**
opts
):
"""
Run all checker functions
...
...
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