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
Customers reporting issues to supervisors
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
Hi,
you can use the _init hook to adjust the where clause of your query so that you can filter according to your needs.
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.
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
Thanks for that. Is there any examplr available?
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
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
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
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
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
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
Re: Customers reporting issues to supervisors
Hi,
have a look at
https://bigprof.com/appgini/help/advanc ... Info-array
$memberInfo['username'] will be your friend.
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.
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
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
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
Re: Customers reporting issues to supervisors
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.
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
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
if($memberInfo['username']=='db.personinchage')
So supervisors can see only where ticket is asigned to them.
Thanks
Re: Customers reporting issues to supervisors
Hi,
you can put an additional
for the db.persnincharge to select only those records asigned to him/her.
you can put an additional
Code: Select all
$options->QueryWhere="PLACE YOUR RESTRICTION HERE"
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.
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Customers reporting issues to supervisors
Amazing help! Thanks a LOT
Re: Customers reporting issues to supervisors
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.