Exemple #1
0
    def get_acl(self, obj):
        if not self.whitelabel_settings:
            return {}
        acl = get_acl_user_submit_edition_by_consign(
            obj, whitelabel_settings=self.whitelabel_settings)

        # override the users acl with the whitelabel settings
        return merge_acl_dict_with_object(acl, self.whitelabel_settings)
Exemple #2
0
    def get_acl(self, obj):
        if not self.whitelabel_settings:
            return {}

        try:
            acl = get_acl_submit_piece_by_loan(obj, self.request.user, whitelabel_settings=self.whitelabel_settings)
            # override the edition acl with the whitelabel settings
            acl = merge_acl_dict_with_object(acl, self.whitelabel_settings)
            # override the edition acl with the whitelabel settings
            user_acl = get_acl_user_submit_piece_by_loan_and_publiccontract(self.request.user,
                                                                            whitelabel_settings=self.whitelabel_settings)
            return merge_acl_dicts(acl, user_acl)
        except Exception as e:
            return {}
Exemple #3
0
    def get_acl(self, obj):
        try:
            from acl.serializers import ActionControlSerializer

            request = self.context.get('request', None)
            subdomain = request.parser_context['kwargs']['domain_pk']
            prize = Prize.objects.get(whitelabel_settings__subdomain=subdomain)
            settings = WhitelabelSettings.objects.get(subdomain=subdomain)
            acl = obj.acl(request.user).__dict__
            acl['acl_wallet_submit'] = (obj.user_registered == request.user
                                        and prize.active)
            # override the users acl with the whitelabel settings
            return merge_acl_dict_with_object(acl, settings)
        except Exception as e:
            if is_jury_from_request(self.context.get('request', None)):
                return {'acl_loan_request': True}
            return {}
Exemple #4
0
    def get_acl(self, obj):
        if not self.whitelabel_settings:
            return {}

        try:
            acl = get_acl_submit_edition_by_consign(
                obj,
                self.request.user,
                whitelabel_settings=self.whitelabel_settings)
            # override the edition acl with the whitelabel settings
            acl = merge_acl_dict_with_object(acl, self.whitelabel_settings)
            # override the edition acl with the whitelabel settings
            user_acl = get_acl_user_submit_edition_by_consign(
                self.request.user,
                whitelabel_settings=self.whitelabel_settings)
            return merge_acl_dicts(acl, user_acl)
        except Exception:
            return {}
Exemple #5
0
 def get_acl(self, obj):
     if not self.whitelabel_settings:
         return {}
     acl = get_acl_user_submit_piece_by_loan_and_publiccontract(obj, whitelabel_settings=self.whitelabel_settings)
     return merge_acl_dict_with_object(acl, self.whitelabel_settings)