Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
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
AlekSIS®
Official
AlekSIS-Core
Commits
e6206af4
Commit
e6206af4
authored
4 years ago
by
Hangzhi Yu
Browse files
Options
Downloads
Patches
Plain Diff
Rename is_person predicate to is_current_person
parent
7f3a445d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!207
Resolve "Roles and permissions"
Pipeline
#1587
failed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/rules.py
+6
-6
6 additions, 6 deletions
aleksis/core/rules.py
aleksis/core/util/predicates.py
+1
-1
1 addition, 1 deletion
aleksis/core/util/predicates.py
with
7 additions
and
7 deletions
aleksis/core/rules.py
+
6
−
6
View file @
e6206af4
...
...
@@ -5,7 +5,7 @@ from aleksis.core.util.predicates import (
has_person_predicate
,
has_global_perm
,
has_any_object
,
is_person
,
is_
current_
person
,
has_object_perm
,
)
...
...
@@ -27,31 +27,31 @@ add_perm("core.view_persons", view_persons_predicate)
# View person
view_person_predicate
=
has_person_predicate
&
(
has_global_perm
(
"
core.view_person
"
)
|
has_object_perm
(
"
core.view_person
"
)
|
is_person
has_global_perm
(
"
core.view_person
"
)
|
has_object_perm
(
"
core.view_person
"
)
|
is_
current_
person
)
add_perm
(
"
core.view_person
"
,
view_person_predicate
)
# View person address
view_address_predicate
=
has_person_predicate
&
(
has_global_perm
(
"
core.view_address
"
)
|
has_object_perm
(
"
core.view_address
"
)
|
is_person
has_global_perm
(
"
core.view_address
"
)
|
has_object_perm
(
"
core.view_address
"
)
|
is_
current_
person
)
add_perm
(
"
core.view_address
"
,
view_address_predicate
)
# View person contact details
view_contact_details_predicate
=
has_person_predicate
&
(
has_global_perm
(
"
core.view_contact_details
"
)
|
has_object_perm
(
"
core.view_contact_details
"
)
|
is_person
has_global_perm
(
"
core.view_contact_details
"
)
|
has_object_perm
(
"
core.view_contact_details
"
)
|
is_
current_
person
)
add_perm
(
"
core.view_contact_details
"
,
view_contact_details_predicate
)
# View person photo
view_photo_predicate
=
has_person_predicate
&
(
has_global_perm
(
"
core.view_photo
"
)
|
has_object_perm
(
"
core.view_photo
"
)
|
is_person
has_global_perm
(
"
core.view_photo
"
)
|
has_object_perm
(
"
core.view_photo
"
)
|
is_
current_
person
)
add_perm
(
"
core.view_photo
"
,
view_photo_predicate
)
# View persons groups
view_groups_predicate
=
has_person_predicate
&
(
has_global_perm
(
"
core.view_person_groups
"
)
|
has_object_perm
(
"
core.view_person_groups
"
)
|
is_person
has_global_perm
(
"
core.view_person_groups
"
)
|
has_object_perm
(
"
core.view_person_groups
"
)
|
is_
current_
person
)
add_perm
(
"
core.view_person_groups
"
,
view_groups_predicate
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/predicates.py
+
1
−
1
View file @
e6206af4
...
...
@@ -80,7 +80,7 @@ def has_person_predicate(user: User) -> bool:
@predicate
def
is_person
(
user
:
User
,
obj
:
Model
)
->
bool
:
def
is_
current_
person
(
user
:
User
,
obj
:
Model
)
->
bool
:
"""
Predicate which checks if the provided object is the person linked to the user object
"""
return
user
.
person
==
obj
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