56c8b8b Fix for API call with token

Authored and Committed by zlopez 17 days ago
    Fix for API call with token
    
    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.
    
        
  • jenkins
    pending
    Build #377 in progress (commit: 56c8b8b2)
    17 days ago
  • jenkins
    success (100%)
    Build #377 successful (commit: 56c8b8b2)
    17 days ago
file modified
+1 -0