Customers reporting issues to supervisors

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Customers reporting issues to supervisors

Post by arcanebits » 2021-11-06 15:11

Hi to all
I have only One table in wich customers will report issues, all good, ultil the supervisors thing came up. The supervisors must only see the issues of customers asigned to them. Ie

Cus1 SupervisorA
Cus2 SupervisorC
Cus3 SupervisorA
Cus4 SupervisorB
Cus5 SupervisorC
Cus6 SupervisorB

Is any way to acomplish this.?

Aldo

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Customers reporting issues to supervisors

Post by pbottcher » 2021-11-06 17:16

Hi,

you can use the _init hook to adjust the where clause of your query so that you can filter according to your needs.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: Customers reporting issues to supervisors

Post by arcanebits » 2021-11-09 12:03

Thanks for that. Is there any examplr available?

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: Customers reporting issues to supervisors

Post by arcanebits » 2021-11-12 14:05

Hi again, after some research im quite impressed about the power of the Hooks, I need a little help with convert this example to what i do need
BELOW IS AN EXAMPLE I THINK WILL WORK FOR ME NOT TESTED CAUSE IM NOT SURE HOW TO TIE LOGGED IN USER WITH A FIELD, and if the Filter is well placed

function customers_init(&$options, $memberInfo, &$args){
/* Apply a default filter only if no filter is already applied by the user */
if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){
/*
In the call below, we want to display records of the customers
table where the value of the 7th field is equal to 'New'.
*/
addFilter(1, 'and', 7, 'equal-to', 'New'); --->>>> Here, how do i say "Show records only for AsignedField=LoggedInUser <<<<----
}
return TRUE;
}

Thanks for any help!
Aldo

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: Customers reporting issues to supervisors

Post by arcanebits » 2021-11-12 14:15

Just as a comment: I purchased and own: Customizing AppGini web applications Extend what your AppGini web applications can do. Learn the fine details of tailoring the generated code efficiently. On Udemy, I tottally recommend it!
Im on a heavy rush sleeping just 4 hours for a deliver and its a big BIG maybe, im not thinking clearly, Just need to filter all data shown with the username of the logged user ie
addFilter(ALL DATA, logedinuser, 'equal-to', 'Data.Supervisor')
any help is more than welcome.
Aldo

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Customers reporting issues to supervisors

Post by pbottcher » 2021-11-12 19:59

Hi,
have a look at

https://bigprof.com/appgini/help/advanc ... Info-array

$memberInfo['username'] will be your friend.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: Customers reporting issues to supervisors

Post by arcanebits » 2021-11-14 18:53

Nice, this is the part I think I need just a little push
function tablename_init(&$options, $memberInfo, &$args){

if($memberInfo['group']=='Admins'){ //Mine--> if($memberInfo['username']=='db.personinchage') <--//
$options->AllowCSV=1;
}else{
$options->AllowCSV=0;
}

return true;
}


Just need that part.
Thanks in advance.
Aldo

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Customers reporting issues to supervisors

Post by pbottcher » 2021-11-14 20:14

ok, so what is your question now?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: Customers reporting issues to supervisors

Post by arcanebits » 2021-11-17 20:55

Hi. Using that example I need to verify that logged in user is equal to a database field.
if($memberInfo['username']=='db.personinchage')
So supervisors can see only where ticket is asigned to them.

Thanks

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Customers reporting issues to supervisors

Post by pbottcher » 2021-11-17 22:03

Hi,

you can put an additional

Code: Select all

 $options->QueryWhere="PLACE YOUR RESTRICTION HERE"
for the db.persnincharge to select only those records asigned to him/her.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: Customers reporting issues to supervisors

Post by arcanebits » 2022-01-10 17:02

Amazing help! Thanks a LOT

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Customers reporting issues to supervisors

Post by pbottcher » 2022-01-10 18:26

Just to add to this. If you need to make sure that the person will not have direct access (by knowing the URL for a selectedID, verify if the request contains a selectedID and add a query beforehand and check if the has access to that selectedID, if not redirect the user to the tableview.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply