chaskunz
|
| Posted: 06/26/2002, 2:40 PM |
|
This code in person_maint_events.php works fine - only allows user to edit own page, and only admin level user to add new.
function Page_AfterInitialize() { //Page_AfterInitialize @1-56434BCA
//Custom Code @44-2A29BDB7
// -------------------------
global $person;
global $DBConnection1;
$current_emp = CCGetParam("person_id","");
$current_user = CCGetUserID();
if($current_emp != 0 && $current_user != CCDLookUp("user_id","user","person_id=".
$DBConnection1->ToSQL($current_emp,ccsInteger),$DBConnection1)
&& CCDLookUp("group_id","user","user_id=".
$DBConnection1->ToSQL($current_user,ccsInteger),$DBConnection1) < 2){
$person->UpdateAllowed = false;
$person->DeleteAllowed = false;
}
elseif(CCDLookUp("group_id","user","user_id=".
$DBConnection1->ToSQL($current_user,ccsInteger),$DBConnection1) < 2){
$person->InsertAllowed = false;
}
// -------------------------
//End Custom Code
} //Close Page_AfterInitialize @1-FCB6E20C
but this very similar code in phone_maint_events.php doesn't. I've changed phone_list to only show where phone.person_id = {person_id}, and so the parameters are passed correctly: http://localhost:8090/portal/phone_maint.php?person_id=21&phone_id=18.
Here is the code:
function Page_AfterInitialize() { //Page_AfterInitialize @1-56434BCA
//Custom Code @17-2A29BDB7
// -------------------------
global $phone;
global $DBConnection1;
$current_emp = CCGetParam("person_id","");
$current_user = CCGetUserID();
if($current_emp != 0 && $current_user != CCDLookUp("user_id","user","person_id=".
$DBConnection1->ToSQL($current_emp,ccsInteger),$DBConnection1)
&& CCDLookUp("group_id","user","user_id=".
$DBConnection1->ToSQL($current_user,ccsInteger),$DBConnection1) < 2){
$phone->UpdateAllowed = false;
$phone->DeleteAllowed = false;
$phone->InsertAllowed = false;
}
// -------------------------
//End Custom Code
} //Close Page_AfterInitialize @1-FCB6E20C
Any suggestions?
|
|
|
 |
Chris K.
|
| Posted: 06/27/2002, 4:29 PM |
|
Try this:
function Page_AfterInitialize() { //Page_AfterInitialize @1-56434BCA
//Custom Code @17-2A29BDB7
// -------------------------
global $phone;
global $DBConnection1;
$current_emp = CCGetParam("person_id",0);
$current_user = CCGetUserID();
if($current_emp == 0 || ($current_emp != 0 && $current_user != CCDLookUp("user_id","user","person_id=".$DBConnection1->ToSQL($current_emp,ccsInteger),$DBConnection1) && CCDLookUp("group_id","user","user_id=".$DBConnection1->ToSQL($current_user,ccsInteger),$DBConnection1) < 2))
{
$phone->UpdateAllowed = false;
$phone->DeleteAllowed = false;
$phone->InsertAllowed = false;
}
// -------------------------
//End Custom Code
} //Close Page_AfterInitialize @1-FCB6E20C
|
|
|
 |
chaskunz
|
| Posted: 07/01/2002, 7:57 AM |
|
No change in result. The person_id and phone_id is being passed on the url line, so why is it not being processed correctly?
|
|
|
 |
|