#5525 Fix for API call with token
Merged by ngompa. Opened by zlopez.
zlopez/pagure fix_api  into  master

Download 5525.patch

Recently on staging deployment of src.stg.fedoraproject.org I encountered
issue with AttributeError: 'User' object has no attribute 'can_create'. After some digging with help from pagure matrix channel
and from @abompard I was able to found out that there is a fix for that
on src.fedoraproject.org, but it's not documented anywhere. So I'm
submitting this PR with the fix.

Here is the reasoning behind it. The API doesn't use OIDC
authentication, but instead using token, so the flask.g.fas_user
doesn't contain can_create attribute as this one is added during OIDC
authentication. This patch is checking if the attribute is present first.

Pull-Request has been merged by ngompa

Metadata