def add_group(self, req, resp, user_id): user = tradius_user() user.sql_id(user_id) validate_access(req, user) attr = obj(req, tradius_user_group) attr['user_id'] = user_id attr.commit()
def attrs(self, req, resp, user_id): user = tradius_user() user.sql_id(user_id) validate_access(req, user) where = {'user_id': user_id} return sql_list(req, 'tradius_user_attr', ( 'id', 'attribute', 'op', 'value', ), where=where)
def rm_attr(self, req, resp, user_id, group_id): user = tradius_user() user.sql_id(user_id) validate_access(req, user) attr = obj(req, tradius_user_attr, sql_id=group_id) attr.commit()
def groups(self, req, resp, user_id): user = tradius_user() user.sql_id(user_id) validate_access(req, user) user_groups = get_user_groups(user_id) return raw_list(req, user_groups, sql=False)