Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Tezor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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®
Onboarding
AlekSIS-App-Tezor
Merge requests
!3
Implement payment backends and interaction
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Implement payment backends and interaction
payment-backends
into
master
Overview
0
Commits
26
Pipelines
17
Changes
2
Merged
Nik | Klampfradler
requested to merge
payment-backends
into
master
3 years ago
Overview
0
Commits
26
Pipelines
17
Changes
2
Expand
Advances
#3 (closed)
Edited
3 years ago
by
Tom Teichler
0
0
Merge request reports
Viewing commit
9b92d753
Prev
Next
Show latest version
2 files
+
82
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
9b92d753
Merge branch 'master' into payment-backends
· 9b92d753
Tom Teichler
authored
3 years ago
aleksis/apps/tezor/rules.py
0 → 100644
+
72
−
0
Options
import
rules
from
.models.base
import
Client
from
.models.invoice
import
Invoice
,
InvoiceGroup
from
aleksis.core.util.predicates
import
has_person
,
has_global_perm
,
has_any_object
,
has_object_perm
# View clients
view_clients_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.view_client
"
)
|
has_any_object
(
"
tezor.view_client
"
,
Client
)
)
rules
.
add_perm
(
"
tezor.view_clients_rule
"
,
view_clients_predicate
)
# View client
view_client_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.view_client
"
)
|
has_object_perm
(
"
tezor.view_client
"
)
)
rules
.
add_perm
(
"
tezor.view_client_rule
"
,
view_client_predicate
)
# Edit clients
edit_client_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.edit_client
"
)
|
has_object_perm
(
"
tezor.edit_client
"
)
)
rules
.
add_perm
(
"
tezor.edit_client_rule
"
,
edit_client_predicate
)
# Create clients
create_client_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.create_client
"
)
|
has_any_object
(
"
tezor.create_client
"
,
Client
)
)
rules
.
add_perm
(
"
tezor.create_client_rule
"
,
create_client_predicate
)
# Delete clients
delete_client_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.delete_client
"
)
|
has_object_perm
(
"
tezor.delete_client
"
)
)
rules
.
add_perm
(
"
tezor.delete_client_rule
"
,
delete_client_predicate
)
# View invoice groups
view_invoice_groups_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.view_invoice_group
"
)
|
has_any_object
(
"
tezor.view_invoice_group
"
,
InvoiceGroup
)
)
rules
.
add_perm
(
"
tezor.view_invoice_groups_rule
"
,
view_invoice_groups_predicate
)
# View invoice_group
view_invoice_group_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.view_invoice_group
"
)
|
has_object_perm
(
"
tezor.view_invoice_group
"
)
)
rules
.
add_perm
(
"
tezor.view_invoice_group_rule
"
,
view_invoice_group_predicate
)
# Edit invoice groups
edit_invoice_group_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.edit_invoice_group
"
)
|
has_object_perm
(
"
tezor.edit_invoice_group
"
)
)
rules
.
add_perm
(
"
tezor.edit_invoice_group_rule
"
,
edit_invoice_group_predicate
)
# Create invoice groups
create_invoice_groups_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.create_invoice_group
"
)
|
has_any_object
(
"
tezor.create_invoice_group
"
,
InvoiceGroup
)
)
rules
.
add_perm
(
"
tezor.create_invoice_groups_rule
"
,
create_invoice_groups_predicate
)
# Delete invoice groups
delete_invoice_groups_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.delete_invoice_group
"
)
|
has_any_object
(
"
tezor.delete_invoice_group
"
,
InvoiceGroup
)
)
rules
.
add_perm
(
"
tezor.delete_invoice_groups_rule
"
,
delete_invoice_groups_predicate
)
# View invoice
view_invoice_predicate
=
has_person
&
(
has_global_perm
(
"
tezor.view_invoice
"
)
|
has_object_perm
(
"
tezor.view_invoice
"
)
)
rules
.
add_perm
(
"
tezor.view_invoice_rule
"
,
view_invoice_predicate
)
Loading