#include "rbac_user_model.h" #include "modules/rbac_users/rbac_user.h" #include "modules/rbac/rbac_controller.h" Ref RBACUserModel::get_user(const int id) { Ref u = UserModel::get_user(id); if (u.is_valid()) { u->rbac_rank = RBACController::get_singleton()->get_rank(u->rank); } return u; } Ref RBACUserModel::get_user(const String &user_name_input) { Ref u = UserModel::get_user(user_name_input); if (u.is_valid()) { u->rbac_rank = RBACController::get_singleton()->get_rank(u->rank); } return u; } Vector > RBACUserModel::get_all() { Vector > users = UserModel::get_all(); for (int i = 0; i < users.size(); ++i) { Ref u = users[i]; if (u.is_valid()) { u->rbac_rank = RBACController::get_singleton()->get_rank(u->rank); } } return users; } Ref RBACUserModel::create_user() { Ref u; u.instance(); u->rank = RBACController::get_singleton()->get_default_rank_id(); u->rbac_rank = RBACController::get_singleton()->get_rank(u->rank); return u; } RBACUserModel::RBACUserModel() : UserModel() { } RBACUserModel::~RBACUserModel() { }