Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
8133db80
Commit
8133db80
authored
Feb 05, 2017
by
Krophil
Committed by
Sli
Mar 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix permission for companies
parent
554929b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
accounting/models.py
accounting/models.py
+26
-0
No files found.
accounting/models.py
View file @
8133db80
...
...
@@ -45,6 +45,32 @@ class Company(models.Model):
class
Meta
:
verbose_name
=
_
(
"company"
)
def
is_owned_by
(
self
,
user
):
"""
Method to see if that object can be edited by the given user
"""
if
user
.
is_in_group
(
settings
.
SITH_GROUP_ACCOUNTING_ADMIN_ID
):
return
True
return
False
def
can_be_edited_by
(
self
,
user
):
"""
Method to see if that object can be edited by the given user
"""
for
club
in
user
.
memberships
.
filter
(
end_date
=
None
).
all
():
if
club
and
club
.
role
==
7
:
return
True
return
False
def
can_be_viewed_by
(
self
,
user
):
"""
Method to see if that object can be viewed by the given user
"""
for
club
in
user
.
memberships
.
filter
(
end_date
=
None
).
all
():
if
club
and
club
.
role
>=
7
:
return
True
return
False
def
get_absolute_url
(
self
):
return
reverse
(
'accounting:co_edit'
,
kwargs
=
{
'co_id'
:
self
.
id
})
...
...
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