예제 #1
0
파일: user.py 프로젝트: samuelbaizg/ssguan
def delete_role(role_id, modifier_id):
    query = UserRole.all()
    query.filter("role_id =", role_id)
    if query.count() > 0 :
        raise CoreError("The role %s is set to user, can not be deleted." % role_id)
    role = Role.get_by_key(int(role_id))
    delete_roleoperations(role_id=role_id)
    role.delete(modifier_id)
예제 #2
0
파일: user.py 프로젝트: samuelbaizg/ssguan
def get_role(role_id=None, role_name=None):
    if role_id != None:
        role = Role.get_by_key(role_id)
    else:
        query = Role.all()
        query.filter("role_name =", role_name)
        role = query.get()
    return role