CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> Archive -> GotoCode Archive

 Assig multiple groups to a user for CCS security

Print topic Send  topic

Author Message
Posted: 12/06/2003, 10:12 AM

I have created security groups for various admin roles. Since these roles don't lend themselves to a hierarchical structure, I need to assign multiple groups to a single user. I'd like to stay away from changing the common.php file. Is there another way to accomplish this?


Posted: 12/07/2003, 8:22 AM

I don't think so. We are looking in to this as well but I think it would mean re-writing the whole security class. Now it just checks if the level field in the login table is the same(or higher) as the authority setting for a given page. The query that does this would have to be rewritten so it would do a: where level in(1,2,3 etc..) check.

There is something of a write around for this in the sense that you can assign multiple access levels to one page. You can set page acces to level 1, 8, 10 and 12 if you wanted to. So instead of assigning multiple gtoups to a single user you can set multiple groups to a single page.

Don Anderson
Posted: 12/08/2003, 2:48 PM

Dear Jessica,

I had a similar issue. Here are the changes I made to common.php. You can probably use the same code, after of course you alter the SQL queries.


//CCUserInGroups @0-9F7F30EA
function CCUserInGroups($GroupID, $GroupsAccess)
$Result = "";

if(strlen($GroupID)) $Groups = explode(",",$GroupID);
while(list($key,$Group) = each($Groups)){
$Result = (strpos(";" . $GroupsAccess . ";", ";" . $Group . ";") !== false);
if ($Result != "") Break;

$Result = true;
return $Result;
//End CCUserInGroups

//CCLoginUser @0-2D4D39C3
//This function is being edited to enable Group data to come from the dz_grp_ref lookup table

/* If MySQL version 4.1 was available, then I'd use the following SELECT:
$SQL = "SELECT dz_user.UID AS UID, Group_ConCat(GID) AS Group FROM dz_user
LEFT JOIN dz_grp_ref ON dz_user.UID = dz_grp_ref.UID
WHERE Username=" . $db->ToSQL($login, ccsText)
. " AND Password=" . $db->ToSQL($password, ccsText)

However, without the GROUP_CONCAT function we have to do it is two steps.

function CCLoginUser($login, $password)
$db = new clsDBlinksdb();
$SQL = "SELECT UID FROM dz_user WHERE Username=" . $db->ToSQL($login, ccsText) . " AND Password=" . $db->ToSQL($password, ccsText);
$Result = $db->next_record();
CCSetSession("UserID", $db->f("UID"));
CCSetSession("UserLogin", $login);

$Groups = "";
$SQL = "SELECT DISTINCT(GID) FROM dz_grp_ref WHERE UID=" . $db->f("UID") . " ORDER BY GID";
if ($db->next_record())
$Groups .= $db->f("GID") .",";
} while ($db->next_record());
$Groups = substr($Groups, 0, -1);

CCSetSession("GroupID", $Groups);
return $Result;
//End CCLoginUser

PS. I also added another function for those times when you want to call a php global in the one line available in many of the CCS dialogs.

function CCGetGlobal($varname)
global $$varname;
return $$varname;
//End CCGetGlobal


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.