Skip to content

Commit

Permalink
fix circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Oct 16, 2024
1 parent a0ab227 commit 9059cdd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions coldfront/core/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from model_utils.models import TimeStampedModel
from simple_history.models import HistoricalRecords

from coldfront.core.department.models import DepartmentProject
from coldfront.core.department.models import Department
from coldfront.core.field_of_science.models import FieldOfScience
from coldfront.core.utils.common import import_from_settings

Expand Down Expand Up @@ -218,9 +218,12 @@ def user_permissions(self, user):

# if the user is an approver in a department connected to the project,
# give them user permissions
department = DepartmentProject.objects.get(project=self).department
for parent_department in department.parents.filter(org_tree='Research Computing Storage Billing'):
if user in parent_department.useraffiliation_set.filter(role='approver'):
departments = Department.objects.filter(
org_tree='Research Computing Storage Billing'
)
proj_departments = [d for d in departments if self in d.get_projects()]
for department in proj_departments:
if user in department.useraffiliation_set.filter(role='approver'):
permissions.append(ProjectPermission.USER)

return permissions
Expand Down

0 comments on commit 9059cdd

Please sign in to comment.