[geeklog-cvs] geeklog-1.3/system lib-security.php,1.21,1.22
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Wed Sep 29 13:43:45 EDT 2004
- Previous message (by thread): [geeklog-cvs] geeklog-1.3/public_html/docs history,1.244,1.245
- Next message (by thread): [geeklog-cvs] geeklog-1.3/public_html/admin block.php,1.62,1.63 event.php,1.51,1.52 link.php,1.44,1.45 poll.php,1.40,1.41 story.php,1.135,1.136 topic.php,1.47,1.48
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv32050/system
Modified Files:
lib-security.php
Log Message:
When setting the default group and the user is not a member of one of the standard Admin groups, find a matching group and use that one instead.
Index: lib-security.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-security.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** lib-security.php 28 Sep 2004 17:34:34 -0000 1.21
--- lib-security.php 29 Sep 2004 17:43:43 -0000 1.22
***************
*** 248,253 ****
* Checks if current user has access to the given object
*
! * This function SEC_takes the access info from a Geeklog object
! * and let's us know if the have access to the object
* returns 3 for read/edit, 2 for read only and 0 for no
* access
--- 248,253 ----
* Checks if current user has access to the given object
*
! * This function takes the access info from a Geeklog object
! * and let's us know if they have access to the object
* returns 3 for read/edit, 2 for read only and 0 for no
* access
***************
*** 289,293 ****
return $perm_anon;
} else {
! // This is a logged in memeber, return their rights
return $perm_members;
}
--- 289,293 ----
return $perm_anon;
} else {
! // This is a logged in member, return their rights
return $perm_members;
}
***************
*** 591,593 ****
--- 591,637 ----
}
+ /**
+ * Return the group to a given feature.
+ *
+ * Scenario: We have a feature and we want to know from which group the user
+ * got this feature. Always returns the lowest group ID, in case the feature
+ * has been inherited from more than one group.
+ *
+ * @param string $feature the feature, e.g 'story.edit'
+ * @param int $uid (optional) user ID
+ * @return int group ID or 0
+ *
+ */
+ function SEC_getFeatureGroup ($feature, $uid = '')
+ {
+ global $_GROUPS, $_TABLES, $_USER;
+
+ if (empty ($uid)) {
+ if (empty ($_USER['uid'])) {
+ $uid = 1;
+ } else {
+ $uid = $_USER['uid'];
+ }
+ if (empty ($_GROUPS)) {
+ $_GROUPS = SEC_getUserGroups ($uid);
+ }
+ } else {
+ $_GROUPS = SEC_getUserGroups ($uid);
+ }
+
+ $group = 0;
+
+ $ft_id = DB_getItem ($_TABLES['features'], 'ft_id', "ft_name = '$feature'");
+ if (($ft_id > 0) && (sizeof ($_GROUPS) > 0)) {
+ $grouplist = implode (',', $_GROUPS);
+ $result = DB_query ("SELECT acc_grp_id FROM {$_TABLES['access']} WHERE (acc_ft_id = $ft_id) AND (acc_grp_id IN ($grouplist)) ORDER BY acc_grp_id LIMIT 1");
+ $A = DB_fetchArray ($result);
+ if (isset ($A['acc_grp_id'])) {
+ $group = $A['acc_grp_id'];
+ }
+ }
+
+ return $group;
+ }
+
?>
- Previous message (by thread): [geeklog-cvs] geeklog-1.3/public_html/docs history,1.244,1.245
- Next message (by thread): [geeklog-cvs] geeklog-1.3/public_html/admin block.php,1.62,1.63 event.php,1.51,1.52 link.php,1.44,1.45 poll.php,1.40,1.41 story.php,1.135,1.136 topic.php,1.47,1.48
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the geeklog-cvs
mailing list