Jon Fletcher
|
| Posted: 09/11/2002, 7:30 AM |
|
Hi All
I asked this before but did not get a full answer - Hear it is again.
In CC I was able create a custom login with more levels and sublevels of security.
When converting the app, of course the custom code does not convert.
I would like to know how to do this in CCS - I can fine no tutorials or examples.
Am I to asumme that it is not possible in CCS.
If this is the case then I will need to go back to CC.
Thanks for you help.
JCF
|
|
|
 |
Ken
|
| Posted: 09/11/2002, 7:53 AM |
|
You can create custom security by using the built in Security Groups in CCS. It is quite easy to figure out, but it is different than in CC2.
|
|
|
 |
Jon Fletcher
|
| Posted: 09/11/2002, 8:04 AM |
|
I use PHP and MySQL
I use a contact database - which uses two fields for rights.
I use bitwise functions to determine what access the user has.
So the built in functions do not work - I have it working fine in CC.
Thanks
JCF
|
|
|
 |
Ken
|
| Posted: 09/11/2002, 8:21 AM |
|
Just trying to help! Maybe if you gave an example of the code someone could explain how and where to write the code in CCS? Just a thought!
|
|
|
 |
Jon Fletcher
|
| Posted: 09/11/2002, 8:24 AM |
|
Thank you very much for you suggestion!
Here is the custom login that I used in CC
**************************
$sLogin = get_param("Login");
$sPassword = get_param("Password");
$db->query("SELECT SITENUM, LoginID, Password, SecRights, SecUser, SecWorker, SecAdmin, Email FROM CONTACTS WHERE LoginID = " . tosql($sLogin, "Text") . " AND Password = " . tosql($sPassword, "Text"));
$is_passed=$db->next_record();
if($is_passed)
{
//****** Set Session Var for Dept Usage or Rights
set_session("SecRights", $db->f("SecRights"));
set_session("SecUser", $db->f("SecUser"));
set_session("SecWorker", $db->f("SecWorker"));
set_session("SecAdmin", $db->f("SecAdmin"));
set_session("SITENUM", $db->f("SITENUM"));
set_session("Email", $db->f("Email"));
//set_session("LoginID", $db->f("LoginID"));
set_session("LoginID", $sLogin);
//****** 1 bit = Software Support or 1 - 536870912 = Admin User, bit 30
if (($db->f("SecRights") & 1) > 0 or ($db->f("SecRights") & 536870912) > 0 )
{
$SecLevel = CheckRights(1);
set_session("SecLevel", $SecLevel);
}
//****** 2 bit = Hardware Support or 2 - 536870912 = Admin User, bit 30
if (($db->f("SecRights") & 2) > 0 or ($db->f("SecRights") & 536870912) > 0 )
{
$SecLevel = CheckRights(2);
set_session("SecLevel", $SecLevel);
}
//****** 3 bit = Electrical Network or 4 - 536870912 = Admin User, bit 30
if (($db->f("SecRights") & 4) > 0 or ($db->f("SecRights") & 536870912) > 0 )
{
$SecLevel = CheckRights(4);
set_session("SecLevel", $SecLevel);
}
switch (get_session("SecLevel"))
{
case 1:
header("Location: UserINCIDENTGrid.php");
break;
case 2:
header("Location: WorkMenu.php");
break;
case 3:
header("Location: AdminMenu.php");
break;
default:
header("Location: index.php");
break;
}
}
else
{
$sLoginErr = "Login or Password is incorrect or You do not have Rights.";
}
***********************
I just need some guidance on converting to CCS - Just not sure where to start.
Thanks
JCF
|
|
|
 |
Alex
|
| Posted: 09/11/2002, 10:41 AM |
|
Just put the "Custom code" action on the OnClick event of the Login button and copy your code there.
And of course you will need to modify your code because of the CCS code structure.
Please do the following :
1. use different session variables: UserID, GroupID, UserLogin.
2. assign a value to the $Redirect variable instead of using the Location function.
3. use $FormName->Errors->addError("...") instead of $sLoginErr.
4. use a different variable for the database access (create an instance of clsDB... class).
|
|
|
 |
|