mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Removed revoke parameter from RBACPermission.
This commit is contained in:
parent
955a1b38fd
commit
e273beee27
@ -217,7 +217,7 @@ void RBACController::admin_render_permission_editor_main_view(Request *request,
|
||||
b.div()->cls("row");
|
||||
{
|
||||
b.w("-- Rank: [ Id ]: ")->wn(perm->id)->w(", [ Rank Id ]: ")->wn(perm->rank_id)->w(", [ Name ]: ")->w(perm->name);
|
||||
b.w(" [ URL ]: ")->w(perm->url)->w(", [ Revoke ]: ")->wbn(perm->revoke)->w(", [ Sort Order ]: ")->wn(perm->sort_order);
|
||||
b.w(" [ URL ]: ")->w(perm->url)->w(", [ Sort Order ]: ")->wn(perm->sort_order);
|
||||
b.w(" [ Permissions ]: ")->wn(perm->permissions);
|
||||
}
|
||||
b.cdiv();
|
||||
@ -240,14 +240,12 @@ void RBACController::admin_render_permission_editor_entry_edit_create_view(Reque
|
||||
|
||||
String name;
|
||||
String url;
|
||||
bool revoke = false;
|
||||
int sort_order = 0;
|
||||
int permissions = 0;
|
||||
|
||||
if (perm.is_valid()) {
|
||||
name = perm->name;
|
||||
url = perm->url;
|
||||
revoke = perm->revoke;
|
||||
sort_order = perm->sort_order;
|
||||
permissions = perm->permissions;
|
||||
}
|
||||
@ -276,8 +274,6 @@ void RBACController::admin_render_permission_editor_entry_edit_create_view(Reque
|
||||
b.input()->type("text")->name("name")->value(name)->f()->br();
|
||||
b.w("URL:")->br();
|
||||
b.input()->type("text")->name("url")->value(url)->f()->cinput()->br();
|
||||
b.w("Revoke:")->br();
|
||||
b.input()->type("checkbox")->name("revoke")->value("revoke")->checked(revoke)->f()->cinput()->br();
|
||||
|
||||
//todo permissions (checkboxes + register api)
|
||||
|
||||
@ -307,7 +303,6 @@ bool RBACController::admin_process_permission_editor_entry_edit_create_post(Requ
|
||||
|
||||
perm->name = request->get_parameter("name");
|
||||
perm->url = request->get_parameter("url");
|
||||
perm->revoke = request->get_parameter("settings").to_int();
|
||||
perm->permissions = request->get_parameter("permissions").to_int();
|
||||
|
||||
//set this up in the form by default
|
||||
|
@ -31,7 +31,7 @@ std::map<int, Ref<RBACRank> > RBACModel::load_permissions() {
|
||||
}
|
||||
|
||||
qb->reset();
|
||||
qb->select("id,rank_id,name,url,revoke,sort_order,permissions")->from(RBAC_PERMISSION_TABLE);
|
||||
qb->select("id,rank_id,name,url,sort_order,permissions")->from(RBAC_PERMISSION_TABLE);
|
||||
res = qb->run();
|
||||
|
||||
while (res->next_row()) {
|
||||
@ -42,9 +42,8 @@ std::map<int, Ref<RBACRank> > RBACModel::load_permissions() {
|
||||
p->rank_id = res->get_cell_int(1);
|
||||
p->name = res->get_cell_str(2);
|
||||
p->url = res->get_cell_str(3);
|
||||
p->revoke = res->get_cell_bool(4);
|
||||
p->sort_order = res->get_cell_int(5);
|
||||
p->permissions = res->get_cell_int(6);
|
||||
p->sort_order = res->get_cell_int(4);
|
||||
p->permissions = res->get_cell_int(5);
|
||||
|
||||
Ref<RBACRank> r = ranks[p->rank_id];
|
||||
|
||||
@ -115,8 +114,8 @@ void RBACModel::save_permission(const Ref<RBACPermission> &permission) {
|
||||
Ref<QueryBuilder> qb = DatabaseManager::get_singleton()->ddb->get_query_builder();
|
||||
|
||||
if (permission->id == 0) {
|
||||
qb->insert(RBAC_PERMISSION_TABLE, "rank_id,name,url,revoke,sort_order,permissions")->values();
|
||||
qb->val(permission->rank_id)->val(permission->name)->val(permission->url)->val(permission->revoke);
|
||||
qb->insert(RBAC_PERMISSION_TABLE, "rank_id,name,url,sort_order,permissions")->values();
|
||||
qb->val(permission->rank_id)->val(permission->name)->val(permission->url);
|
||||
qb->val(permission->sort_order)->val(permission->permissions);
|
||||
qb->cvalues();
|
||||
qb->select_last_insert_id();
|
||||
@ -131,7 +130,6 @@ void RBACModel::save_permission(const Ref<RBACPermission> &permission) {
|
||||
qb->setp("rank_id", permission->rank_id);
|
||||
qb->setp("name", permission->name);
|
||||
qb->setp("url", permission->url);
|
||||
qb->setp("revoke", permission->revoke);
|
||||
qb->setp("sort_order", permission->sort_order);
|
||||
qb->setp("permissions", permission->permissions);
|
||||
qb->cset();
|
||||
@ -163,7 +161,6 @@ void RBACModel::create_table() {
|
||||
tb->integer("rank_id")->not_null()->next_row();
|
||||
tb->varchar("name", 60)->not_null()->next_row();
|
||||
tb->varchar("url", 100)->not_null()->next_row();
|
||||
tb->integer("revoke")->not_null()->next_row();
|
||||
tb->integer("sort_order")->not_null()->next_row();
|
||||
tb->integer("permissions")->not_null()->next_row();
|
||||
|
||||
|
@ -13,7 +13,6 @@ RBACPermission::RBACPermission() :
|
||||
|
||||
id = 0;
|
||||
rank_id = 0;
|
||||
revoke = false;
|
||||
sort_order = 0;
|
||||
permissions = 0;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ public:
|
||||
int rank_id;
|
||||
String name;
|
||||
String url;
|
||||
bool revoke;
|
||||
int sort_order;
|
||||
int permissions;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user