コード例 #1
0
    def __init__(self, resource, dataset):
        needs = []
        if hasattr(resource, 'organization') or hasattr(resource, 'owner'):
            # This is a community resource.
            if resource.organization:
                needs.append(OrganizationAdminNeed(resource.organization.id))
                needs.append(OrganizationEditorNeed(resource.organization.id))
            elif resource.owner:
                needs.append(UserNeed(resource.owner.id))
        else:
            if dataset.organization:
                needs.append(OrganizationAdminNeed(dataset.organization.id))
                needs.append(OrganizationEditorNeed(dataset.organization.id))
            elif dataset.owner:
                needs.append(UserNeed(dataset.owner.id))

        super(ResourceEditPermission, self).__init__(*needs)
コード例 #2
0
    def __init__(self, reuse):
        needs = []

        if reuse.organization:
            needs.append(OrganizationAdminNeed(reuse.organization.id))
            needs.append(OrganizationEditorNeed(reuse.organization.id))
        elif reuse.owner:
            needs.append(UserNeed(reuse.owner.id))

        super(ReuseEditPermission, self).__init__(*needs)
コード例 #3
0
    def __init__(self, dataset):
        needs = []

        if dataset.organization:
            needs.append(OrganizationAdminNeed(dataset.organization.id))
            needs.append(OrganizationEditorNeed(dataset.organization.id))
        elif dataset.owner:
            needs.append(UserNeed(dataset.owner.id))

        super(DatasetEditPermission, self).__init__(*needs)
コード例 #4
0
    def __init__(self, obj):
        needs = []

        if obj.organization:
            needs.append(OrganizationAdminNeed(obj.organization.id))
            needs.append(OrganizationEditorNeed(obj.organization.id))
        elif obj.owner:
            needs.append(UserNeed(obj.owner.id))

        super(OwnablePermission, self).__init__(*needs)
コード例 #5
0
    def __init__(self, issue):
        needs = []
        subject = issue.subject

        if getattr(subject, 'organization'):
            needs.append(OrganizationAdminNeed(subject.organization.id))
            needs.append(OrganizationEditorNeed(subject.organization.id))
        elif subject.owner:
            needs.append(UserNeed(subject.owner.id))

        super(CloseIssuePermission, self).__init__(*needs)
コード例 #6
0
    def __init__(self, resource, dataset):
        needs = []
        obj = resource if isinstance(resource, CommunityResource) else dataset

        if obj.organization:
            needs.append(OrganizationAdminNeed(obj.organization.id))
            needs.append(OrganizationEditorNeed(obj.organization.id))
        elif obj.owner:
            needs.append(UserNeed(obj.owner.id))

        super(ResourceEditPermission, self).__init__(*needs)
コード例 #7
0
 def __init__(self, transfer):
     if isinstance(transfer.recipient, Organization):
         need = OrganizationAdminNeed(transfer.recipient.id)
     elif isinstance(transfer.recipient, User):
         need = UserNeed(transfer.recipient.id)
     super(TransferResponsePermission, self).__init__(need)
コード例 #8
0
 def __init__(self, subject):
     if subject.organization:
         need = OrganizationAdminNeed(subject.organization.id)
     elif subject.owner:
         need = UserNeed(subject.owner.id)
     super(TransferPermission, self).__init__(need)
コード例 #9
0
    def __init__(self, resource):
        needs = []
        if resource.owner:
            needs.append(UserNeed(resource.owner.id))

        super(CommunityResourceEditPermission, self).__init__(*needs)
コード例 #10
0
ファイル: permissions.py プロジェクト: rfResearch/udata
 def __init__(self, user):
     need = UserNeed(user.id)
     super(UserEditPermission, self).__init__(need)