Passed
Push — 2.x ( 710010...e013a9 )
by Jordi
10:50 queued 05:13
created

senaite.core.permissions.worksheet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 32
rs 10
c 0
b 0
f 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A can_edit_worksheet() 0 4 1
A can_add_worksheet() 0 4 1
A can_add_worksheet_attachment() 0 4 1
A can_manage_worksheets() 0 4 1
1
# -*- coding: utf-8 -*-
2
3
from bika.lims.api.security import check_permission
4
from .permissions import AddWorksheet
5
from .permissions import ManageWorksheets
6
from .permissions import EditWorksheet
7
from .permissions import WorksheetAddAttachment
8
9
10
def can_add_worksheet(context):
11
    """Checks if worksheets can be added in context
12
    """
13
    return check_permission(AddWorksheet, context)
14
15
16
def can_edit_worksheet(context):
17
    """Checks if worksheets can be managed in context
18
    """
19
    return check_permission(EditWorksheet, context)
20
21
22
def can_manage_worksheets(context):
23
    """Checks if worksheets can be managed in context
24
    """
25
    return check_permission(ManageWorksheets, context)
26
27
28
def can_add_worksheet_attachment(context):
29
    """Checks if attachments can be added to worksheet
30
    """
31
    return check_permission(WorksheetAddAttachment, context)
32