def has_permission(doc, ptype, user):
    if ((doc.public == 1) or (user == 'Administrator')):
        return True
    if (user == doc.owner):
        return True
    return False
def has_permission(doc, ptype, user):
    if ((doc.public == 1) or (user == 'Administrator')):
        return True
    if (user == doc.owner):
        return True
    return False