Форуми / Cotonti / Extensions / help wanted with rights

pagecategories

GHengeveld
#27695 31.12.2010 19:10
Loop through $usr['auth']['page'] to get the rights for each category.

None = 0
Read = 1
Write = 2
C1 = 4
C2 = 8
C3 = 16
C4 = 32
C5 = 64
Admin = 128

Value for auth is the sum of the allowed rights (so all rights = 255). C rights are custom rights, they become visible in adminpanel when you click 'more' at a rights configuration screen. C1 is used for pages with a file download (the members only download thing). In Siena C1 is also used for hidden users (if you have this right you can see hidden users).

Use cot_auth_getmask() to convert number into a readable mask, such as RW12345A (255) or RW (3). Then use (strpos($mask, 'R') !== FALSE) to check for read access.

$allowedcats = array();
foreach($usr['auth']['page'] as $category => $rights)
{
	if($category == 'a') continue;
	if(strpos(cot_auth_getmask($rights), 'R') !== FALSE)
	{
		$allowedcats[] = $category;
	}
}
$sqlcategories = implode(',', $allowedcats);

Відредаговано: Koradhil (31.12.2010 19:33, 14 років тому)