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