Skip to content
GitLab
Menu
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):
...
@@ -25,9 +25,6 @@ class OIDCConfig(db_models.Model):
enabled
=
db_models
.
BooleanField
(
default
=
False
)
enabled
=
db_models
.
BooleanField
(
default
=
False
)
name
=
db_models
.
CharField
(
max_length
=
200
)
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 as a list of strings
scopes
=
JSONField
(
scopes
=
JSONField
(
default
=
scopes_default
,
default
=
scopes_default
,
...
@@ -75,14 +72,6 @@ class OIDCConfig(db_models.Model):
...
@@ -75,14 +72,6 @@ class OIDCConfig(db_models.Model):
)
)
return
auth_req
.
request
(
client
.
authorization_endpoint
)
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
():
def
default_idp
():
return
OIDCConfig
.
objects
.
filter
(
enabled
=
True
).
first
()
return
OIDCConfig
.
objects
.
filter
(
enabled
=
True
).
first
()
...
...
django_backend/backend/frontend/serializers.py
View file @
cbb0dc58
...
@@ -80,14 +80,12 @@ class DeploymentSerializer(serializers.ModelSerializer):
...
@@ -80,14 +80,12 @@ class DeploymentSerializer(serializers.ModelSerializer):
# contains properties which change less often
# contains properties which change less often
class
UserSerializer
(
serializers
.
ModelSerializer
):
class
UserSerializer
(
serializers
.
ModelSerializer
):
auth_groups
=
backend_serializers
.
AuthGroupSerializer
(
many
=
True
)
groups
=
backend_serializers
.
GroupSerializer
(
many
=
True
)
groups
=
backend_serializers
.
GroupSerializer
(
many
=
True
)
ssh_keys
=
backend_serializers
.
SSHPublicKeySerializer
(
many
=
True
)
ssh_keys
=
backend_serializers
.
SSHPublicKeySerializer
(
many
=
True
)
class
Meta
:
class
Meta
:
model
=
models
.
User
model
=
models
.
User
fields
=
[
fields
=
[
'auth_groups'
,
'email'
,
'email'
,
'groups'
,
'groups'
,
'id'
,
'id'
,
...
...
django_backend/backend/models.py
View file @
cbb0dc58
...
@@ -411,17 +411,23 @@ class User(AbstractUser):
...
@@ -411,17 +411,23 @@ class User(AbstractUser):
for
dep
in
self
.
deployments
.
all
():
for
dep
in
self
.
deployments
.
all
():
dep
.
deactivate
()
dep
.
deactivate
()
def
update_userinfo
(
self
,
userinfo
):
# authorisation groups
self
.
userinfo
=
userinfo
class
AuthGroup
(
models
.
Model
):
self
.
save
()
name
=
models
.
CharField
(
groups
=
userinfo
.
get
(
'groups'
,
[])
max_length
=
200
,
# FIXME probably inefficient
)
self
.
groups
.
clear
()
users
=
models
.
ManyToManyField
(
User
,
for
group_name
in
groups
:
related_name
=
'auth_groups'
,
query
=
Group
.
objects
.
filter
(
name
=
group_name
)
blank
=
True
,
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
):
class
Site
(
models
.
Model
):
...
...
django_backend/backend/serializers.py
View file @
cbb0dc58
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
from
django.contrib.auth.models
import
Group
from
django.contrib.auth.models
import
Group
from
rest_framework
import
serializers
from
rest_framework
import
serializers
from
.models
import
SSHPublicKey
,
AuthGroup
from
.models
import
SSHPublicKey
class
GroupSerializer
(
serializers
.
ModelSerializer
):
class
GroupSerializer
(
serializers
.
ModelSerializer
):
...
@@ -15,15 +15,6 @@ 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
SSHPublicKeySerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
class
Meta
:
model
=
SSHPublicKey
model
=
SSHPublicKey
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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