Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
cbb0dc58
Commit
cbb0dc58
authored
Jul 03, 2018
by
Lukas Burgey
Browse files
Remove the obsolete authgroup handling
parent
4db0e5da
Changes
4
Hide whitespace changes
Inline
Side-by-side
django_backend/backend/auth/v1/models.py
View file @
cbb0dc58
...
...
@@ -25,9 +25,6 @@ class OIDCConfig(db_models.Model):
enabled
=
db_models
.
BooleanField
(
default
=
False
)
name
=
db_models
.
CharField
(
max_length
=
200
)
# does this idp provide us with group informations?
group_provider
=
db_models
.
BooleanField
(
default
=
False
)
# scopes as a list of strings
scopes
=
JSONField
(
default
=
scopes_default
,
...
...
@@ -75,14 +72,6 @@ class OIDCConfig(db_models.Model):
)
return
auth_req
.
request
(
client
.
authorization_endpoint
)
def
get_user_groupinformation
(
self
,
userinfo
):
if
not
self
.
group_provider
:
return
models
.
AuthGroup
.
objects
.
none
()
LOGGER
.
debug
(
'Retrieving group information for %s'
,
userinfo
)
# TODO actually retrieve the group information
return
models
.
AuthGroup
.
objects
.
none
()
def
default_idp
():
return
OIDCConfig
.
objects
.
filter
(
enabled
=
True
).
first
()
...
...
django_backend/backend/frontend/serializers.py
View file @
cbb0dc58
...
...
@@ -80,14 +80,12 @@ class DeploymentSerializer(serializers.ModelSerializer):
# contains properties which change less often
class
UserSerializer
(
serializers
.
ModelSerializer
):
auth_groups
=
backend_serializers
.
AuthGroupSerializer
(
many
=
True
)
groups
=
backend_serializers
.
GroupSerializer
(
many
=
True
)
ssh_keys
=
backend_serializers
.
SSHPublicKeySerializer
(
many
=
True
)
class
Meta
:
model
=
models
.
User
fields
=
[
'auth_groups'
,
'email'
,
'groups'
,
'id'
,
...
...
django_backend/backend/models.py
View file @
cbb0dc58
...
...
@@ -411,17 +411,23 @@ class User(AbstractUser):
for
dep
in
self
.
deployments
.
all
():
dep
.
deactivate
()
# authorisation groups
class
AuthGroup
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
200
,
)
users
=
models
.
ManyToManyField
(
User
,
related_name
=
'auth_groups'
,
blank
=
True
,
)
def
update_userinfo
(
self
,
userinfo
):
self
.
userinfo
=
userinfo
self
.
save
()
groups
=
userinfo
.
get
(
'groups'
,
[])
# FIXME probably inefficient
self
.
groups
.
clear
()
for
group_name
in
groups
:
query
=
Group
.
objects
.
filter
(
name
=
group_name
)
if
not
query
.
exists
():
LOGGER
.
info
(
"Adding group %s"
,
group_name
)
group
=
Group
(
name
=
group_name
)
group
.
save
()
self
.
groups
.
add
(
group
)
else
:
for
group
in
query
.
all
():
self
.
groups
.
add
(
group
)
class
Site
(
models
.
Model
):
...
...
django_backend/backend/serializers.py
View file @
cbb0dc58
...
...
@@ -3,7 +3,7 @@
from
django.contrib.auth.models
import
Group
from
rest_framework
import
serializers
from
.models
import
SSHPublicKey
,
AuthGroup
from
.models
import
SSHPublicKey
class
GroupSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -15,15 +15,6 @@ class GroupSerializer(serializers.ModelSerializer):
]
class
AuthGroupSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
AuthGroup
fields
=
[
'id'
,
'name'
,
]
class
SSHPublicKeySerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
SSHPublicKey
...
...
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