Skip to content

Commit

Permalink
fix: Load menu item by action_uuid.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Sep 6, 2024
1 parent e95b9b2 commit 5101438
Showing 1 changed file with 123 additions and 121 deletions.
244 changes: 123 additions & 121 deletions src/models/menu_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,141 +106,141 @@ impl MenuItem {
// "R" Report
// "P" Process
// "F" Workflow
let _window_access = match _role.to_owned().window_access {
let _window_access: Vec<String> = match _role.to_owned().window_access {
Some(value) => value,
None => Vec::new()
};
let _form_access = match _role.to_owned().form_access {
let _form_access: Vec<String> = match _role.to_owned().form_access {
Some(value) => value,
None => Vec::new()
};
let _browser_access = match _role.to_owned().browser_access {
let _browser_access: Vec<String> = match _role.to_owned().browser_access {
Some(value) => value,
None => Vec::new()
};
let _process_access = match _role.to_owned().process_access {
let _process_access: Vec<String> = match _role.to_owned().process_access {
Some(value) => value,
None => Vec::new()
};
let _workflow_access = match _role.to_owned().workflow_access {
let _workflow_access: Vec<String> = match _role.to_owned().workflow_access {
Some(value) => value,
None => Vec::new()
};
json!({
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"match": {
"is_summary": true
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid": _window_access
}
},
{
"match": {
"action": "W"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid": _form_access
}
},
{
"match": {
"action": "X"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid": _browser_access
}
},
{
"match": {
"action": "S"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid": _process_access
}
},
{
"match": {
"action": "P"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid": _process_access
}
},
{
"match": {
"action": "R"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid": _workflow_access
}
},
{
"match": {
"action": "F"
}
}
]
}
}
]
}
}
})
json!({
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"match": {
"is_summary": true
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid.keyword": _window_access
}
},
{
"match": {
"action": "W"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid.keyword": _form_access
}
},
{
"match": {
"action": "X"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid.keyword": _browser_access
}
},
{
"match": {
"action": "S"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid.keyword": _process_access
}
},
{
"match": {
"action": "P"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid.keyword": _process_access
}
},
{
"match": {
"action": "R"
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"action_uuid.keyword": _workflow_access
}
},
{
"match": {
"action": "F"
}
}
]
}
}
]
}
}
})
}
}

Expand All @@ -254,7 +254,9 @@ impl IndexDocument for MenuItem {
"parent_id" : { "type" : "integer" },
"sequence" : { "type" : "integer" },
"name" : { "type" : "text" },
"description" : { "type" : "text" }
"description" : { "type" : "text" },
"action_id" : { "type" : "integer" },
"action_uuid" : { "type" : "keyword" }
}
}
})
Expand Down

0 comments on commit 5101438

Please sign in to comment.