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.
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 channeland 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_userdoesn't contain
can_createattribute as this one is added during OIDCauthentication. This patch is checking if the attribute is present first.