2026 |
2026 |
2027 return array( |
2027 return array( |
2028 'mode' => 'success' |
2028 'mode' => 'success' |
2029 ); |
2029 ); |
2030 break; |
2030 break; |
|
2031 case 'trace': |
|
2032 list($targetpid, $targetns) = RenderMan::strToPageID($parms['page']); |
|
2033 $perms = $session->fetch_page_acl_user($parms['user'], $targetpid, $targetns); |
|
2034 $perm_table = array( |
|
2035 AUTH_ALLOW => 'acl_lbl_field_allow', |
|
2036 AUTH_WIKIMODE => 'acl_lbl_field_wikimode', |
|
2037 AUTH_DISALLOW => 'acl_lbl_field_disallow', |
|
2038 AUTH_DENY => 'acl_lbl_field_deny' |
|
2039 ); |
|
2040 |
|
2041 $return = array( |
|
2042 'mode' => 'trace', |
|
2043 'perms' => array() |
|
2044 ); |
|
2045 |
|
2046 foreach ( $perms->perm_resolve_table as $perm_type => $lookup_data ) |
|
2047 { |
|
2048 if ( !$session->check_acl_scope($perm_type, $targetns) ) |
|
2049 continue; |
|
2050 |
|
2051 $src_l10n = $lang->get($session->acl_inherit_lang_table[$lookup_data['src']], $lookup_data); |
|
2052 $divclass = preg_replace('/^acl_inherit_/', '', $session->acl_inherit_lang_table[$lookup_data['src']]); |
|
2053 $perm_string = $lang->get($perm_table[$perms->perms[$perm_type]]); |
|
2054 $perm_name = $lang->get($session->acl_descs[$perm_type]); |
|
2055 |
|
2056 $return['perms'][$perm_type] = array( |
|
2057 'divclass' => "acl_inherit acl_$divclass", |
|
2058 'perm_type' => $perm_type, |
|
2059 'perm_name' => $perm_name, |
|
2060 'perm_value' => $perm_string, |
|
2061 'perm_src' => $src_l10n, |
|
2062 'rule_id' => intval($lookup_data['rule_id']) |
|
2063 ); |
|
2064 } |
|
2065 |
|
2066 // group rules if possible |
|
2067 $return['groups'] = array(); |
|
2068 foreach ( $return['perms'] as $rule ) |
|
2069 { |
|
2070 if ( !isset($return['groups'][$rule['rule_id']]) ) |
|
2071 { |
|
2072 $return['groups'][$rule['rule_id']] = array(); |
|
2073 } |
|
2074 $return['groups'][$rule['rule_id']][] = $rule['perm_type']; |
|
2075 } |
|
2076 |
|
2077 break; |
2031 default: |
2078 default: |
2032 return Array('mode'=>'error','error'=>'Hacking attempt'); |
2079 return Array('mode'=>'error','error'=>'Hacking attempt'); |
2033 break; |
2080 break; |
2034 } |
2081 } |
2035 } |
2082 } |