~edwargix/git.sr.ht

9a9984966b83a81c1040d90e5b99b83ad63cdad4 — Drew DeVault 6 years ago 8ec6a63
Update ACL access times on push
1 files changed, 4 insertions(+), 0 deletions(-)

M gitsrht/access.py
M gitsrht/access.py => gitsrht/access.py +4 -0
@@ 1,8 1,10 @@
from flask import abort
from datetime import datetime
from enum import IntFlag
from flask_login import current_user
from gitsrht.types import User, Repository, RepoVisibility, Redirect
from gitsrht.types import Access, AccessMode
from srht.database import db

class UserAccess(IntFlag):
    none = 0


@@ 45,6 47,8 @@ def get_access(repo, user=None):
        return UserAccess.read | UserAccess.write | UserAccess.manage
    acl = Access.query.filter(Access.repo_id == repo.id).first()
    if acl:
        acl.updated = datetime.utcnow()
        db.session.commit()
        if acl.mode == AccessMode.ro:
            return UserAccess.read
        else: