Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thies
uffd2
Commits
0043ecc4
Commit
0043ecc4
authored
3 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Fix User-Group and Role-Group relationship config
parent
17b99372
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
uffd/role/models.py
+2
-2
2 additions, 2 deletions
uffd/role/models.py
uffd/user/models.py
+2
-2
2 additions, 2 deletions
uffd/user/models.py
with
4 additions
and
4 deletions
uffd/role/models.py
+
2
−
2
View file @
0043ecc4
...
...
@@ -8,7 +8,7 @@ from uffd.user.models import User
class
RoleGroup
(
db
.
Model
):
__tablename__
=
'
role_groups
'
role_id
=
Column
(
Integer
(),
ForeignKey
(
'
role.id
'
,
onupdate
=
'
CASCADE
'
,
ondelete
=
'
CASCADE
'
),
primary_key
=
True
)
role
=
relationship
(
'
Role
'
)
role
=
relationship
(
'
Role
'
,
back_populates
=
'
groups
'
)
group_id
=
Column
(
Integer
(),
ForeignKey
(
'
group.id
'
,
onupdate
=
'
CASCADE
'
,
ondelete
=
'
CASCADE
'
),
primary_key
=
True
)
group
=
relationship
(
'
Group
'
)
requires_mfa
=
Column
(
Boolean
(),
default
=
False
,
nullable
=
False
)
...
...
@@ -94,7 +94,7 @@ class Role(db.Model):
members
=
relationship
(
'
User
'
,
secondary
=
'
role_members
'
,
back_populates
=
'
roles
'
)
groups
=
relationship
(
'
RoleGroup
'
,
collection_class
=
RoleGroupMap
,
cascade
=
'
all, delete-orphan
'
)
groups
=
relationship
(
'
RoleGroup
'
,
collection_class
=
RoleGroupMap
,
cascade
=
'
all, delete-orphan
'
,
back_populates
=
'
role
'
)
# Roles that are managed externally (e.g. by Ansible) can be locked to
# prevent accidental editing of name, moderator group, included roles
...
...
This diff is collapsed.
Click to expand it.
uffd/user/models.py
+
2
−
2
View file @
0043ecc4
...
...
@@ -84,7 +84,7 @@ class User(db.Model):
mail
=
Column
(
String
(
128
),
nullable
=
False
)
pwhash
=
Column
(
String
(
256
),
nullable
=
True
)
is_service_user
=
Column
(
Boolean
(),
default
=
False
,
nullable
=
False
)
groups
=
relationship
(
'
Group
'
,
secondary
=
'
user_groups
'
)
groups
=
relationship
(
'
Group
'
,
secondary
=
'
user_groups
'
,
back_populates
=
'
members
'
)
roles
=
relationship
(
'
Role
'
,
secondary
=
'
role_members
'
,
back_populates
=
'
members
'
)
@property
...
...
@@ -169,7 +169,7 @@ class Group(db.Model):
unix_gid
=
Column
(
Integer
(),
unique
=
True
,
nullable
=
False
,
default
=
get_next_unix_gid
)
name
=
Column
(
String
(
32
),
unique
=
True
,
nullable
=
False
)
description
=
Column
(
String
(
128
),
nullable
=
False
,
default
=
''
)
members
=
relationship
(
'
User
'
,
secondary
=
'
user_groups
'
)
members
=
relationship
(
'
User
'
,
secondary
=
'
user_groups
'
,
back_populates
=
'
groups
'
)
def
set_name
(
self
,
value
):
if
len
(
value
)
>
32
or
len
(
value
)
<
1
:
...
...
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