Permalink
Browse files

bumped up version to add keys, changed some more UI

  • Loading branch information...
1 parent bcf214d commit 171948fd4a1dc3c2ed1cf24a5e4ec5bd1bc999e9 toyomoyo committed Aug 10, 2006
Showing with 23 additions and 11 deletions.
  1. +13 −8 lib/accesslib.php
  2. +9 −2 user/index.php
  3. +1 −1 version.php
View
@@ -354,10 +354,12 @@ function load_user_capability($capability='', $contextid ='', $userid='') {
$SQL = " SELECT rc.capability, c1.id, (c1.level * 100) AS aggregatelevel,
SUM(rc.permission) AS sum
FROM
- {$CFG->prefix}role_assignments AS ra
- INNER JOIN {$CFG->prefix}role_capabilities AS rc ON ra.roleid=rc.roleid
- INNER JOIN {$CFG->prefix}context AS c1 ON ra.contextid=c1.id
+ {$CFG->prefix}role_assignments AS ra,
+ {$CFG->prefix}role_capabilities AS rc,
+ {$CFG->prefix}context AS c1
WHERE
+ ra.contextid=c1.id AND
+ ra.roleid=rc.roleid AND
ra.userid=$userid AND
c1.id IN $listofcontexts AND
rc.contextid=$siteinstance->id
@@ -371,12 +373,15 @@ function load_user_capability($capability='', $contextid ='', $userid='') {
SELECT rc.capability, c1.id, (c1.level * 100 + c2.level) AS aggregatelevel,
SUM(rc.permission) AS sum
FROM
- {$CFG->prefix}role_assignments AS ra
- INNER JOIN {$CFG->prefix}role_capabilities AS rc ON ra.roleid=rc.roleid
- INNER JOIN {$CFG->prefix}context AS c1 ON ra.contextid=c1.id
- LEFT OUTER JOIN {$CFG->prefix}context AS c2 ON rc.contextid=c2.id
+ {$CFG->prefix}role_assignments AS ra,
+ {$CFG->prefix}role_capabilities AS rc,
+ {$CFG->prefix}context AS c1,
+ {$CFG->prefix}context AS c2
WHERE
- ra.userid=$userid AND
+ ra.contextid=c1.id AND
+ ra.roleid=rc.roleid AND
+ ra.userid=$userid AND
+ rc.contextid=c2.id AND
c1.id IN $listofcontexts AND
c2.id IN $listofcontexts AND rc.contextid != $siteinstance->id
$capsearch
View
@@ -137,20 +137,27 @@
// this needs to check capability too
+
+
$SQL = 'select distinct r.id, r.name from '.$CFG->prefix.'role_assignments ra, '.$CFG->prefix.'role r WHERE
- r.id = ra.roleid AND ra.contextid = '.$contextid;
+ r.id = ra.roleid AND ra.contextid = '.$contextid.' ORDER BY r.sortorder ASC';
$roles = get_records_sql($SQL);
foreach ($roles as $role) {
$options[$role->id] = $role->name;
}
+ if (!$roleid) {
+ $rolesarray = array_keys($options);
+ $roleid = array_shift($rolesarray); // get first element
+ }
+
print ('<form name="rolesform" action="index.php" method="post">');
print ('<div align="center">Current Context: '.print_context_name($contextid).'<br/>');
print ('<input type="hidden" name="contextid" value="'.$contextid.'">Select a Role: ');
print ('<input type="hidden" name="id" value="'.$id.'">');
- choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
+ choose_from_menu ($options, 'roleid', $roleid, '', $script='rolesform.submit()');
print ('</div></form>');
View
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2006080900; // YYYYMMDD = date
+ $version = 2006081000; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.7 dev'; // Human-friendly version name

0 comments on commit 171948f

Please sign in to comment.