Skip to content

Unable to withdraw funds from account with primary user #124

@1john

Description

@1john

If you login to the oscar dashboard as a superuser or a staff user and try to make a withdrawal from a user account that has a primary_user listed, you will not be able to make the withdrawal.

Error message: "Unable to withdraw funds from account: This user is not authorised to make transfers from this account"

Code in question is in can_be_authorized_by() in abstract_models.py line 220:

 def can_be_authorised_by(self, user=None):
        """
        Test whether the passed user can authorise a transfer from this account
        """
        if user is None:
            return True
        if self.primary_user:
            return user == self.primary_user
        secondary_users = self.secondary_users.all()
        if secondary_users.count() > 0:
            return user in secondary_users
        return True

How is a staff or superuser supposed to withdraw from an account? Am I using primary_user wrong?

Seems like there should be:

if user.is_staff or user.is_superuser:
    return True

in that function.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions