Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor 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
thomasDOTwtf
hub
Commits
a233951d
Commit
a233951d
authored
4 months ago
by
Roang
Browse files
Options
Downloads
Patches
Plain Diff
Add ActivityLog to Team
parent
4a0f280d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/models/teams/teams.py
+9
-1
9 additions, 1 deletion
src/core/models/teams/teams.py
with
9 additions
and
1 deletion
src/core/models/teams/teams.py
+
9
−
1
View file @
a233951d
...
@@ -10,6 +10,7 @@ from rules.predicates import is_superuser, predicate
...
@@ -10,6 +10,7 @@ from rules.predicates import is_superuser, predicate
from
core.fields
import
ConferenceReference
from
core.fields
import
ConferenceReference
from
core.markdown
import
compile_translated_markdown_fields
,
store_relationships
from
core.markdown
import
compile_translated_markdown_fields
,
store_relationships
from
core.models.activitylog
import
ActivityLogEntry
,
ActivityLogMixin
from
core.models.invitation
import
Invitation
from
core.models.invitation
import
Invitation
from
core.predicates
import
is_conference_staff
from
core.predicates
import
is_conference_staff
...
@@ -39,7 +40,7 @@ def is_public_team(user: 'PlatformUser', team: 'Team | None' = None) -> bool:
...
@@ -39,7 +40,7 @@ def is_public_team(user: 'PlatformUser', team: 'Team | None' = None) -> bool:
return
not
team
.
require_staff
return
not
team
.
require_staff
class
Team
(
RulesModelMixin
,
Group
,
metaclass
=
RulesModelBase
):
class
Team
(
RulesModelMixin
,
ActivityLogMixin
,
Group
,
metaclass
=
RulesModelBase
):
class
Meta
:
class
Meta
:
rules_permissions
=
{
rules_permissions
=
{
'
view
'
:
is_conference_staff
|
is_public_team
,
'
view
'
:
is_conference_staff
|
is_public_team
,
...
@@ -101,3 +102,10 @@ class Team(RulesModelMixin, Group, metaclass=RulesModelBase):
...
@@ -101,3 +102,10 @@ class Team(RulesModelMixin, Group, metaclass=RulesModelBase):
store_relationships
(
self
.
conference
,
self
,
render_results
)
store_relationships
(
self
.
conference
,
self
,
render_results
)
return
super
().
save
(
*
args
,
update_fields
=
update_fields
,
**
kwargs
)
return
super
().
save
(
*
args
,
update_fields
=
update_fields
,
**
kwargs
)
def
get_activity_log_kind_for_user
(
self
,
user
:
'
PlatformUser
'
)
->
ActivityLogEntry
.
Kind
:
if
self
.
members
.
filter
(
user
=
user
).
exists
():
return
ActivityLogEntry
.
Kind
.
ENTITY
if
user
.
is_superuser
:
return
ActivityLogEntry
.
Kind
.
STAFF
return
ActivityLogEntry
.
Kind
.
OTHER
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