* is_edit_auth() が欲しい [#s5c62ddc] - ページ: [[BugTrack2]] - 投稿者: [[sonots]] - 優先順位: 低 - 状態: 提案 - カテゴリー: その他 - 投稿日: 2006-06-25 (日) 04:41:11 - バージョン: ** メッセージ [#q4ea43a4] 凍結に対しては is_freeze がありますが、 ほぼ同等の効果のある編集制限に対しては is_edit_auth がありません。 プラグインを作成していて欲しいときがあるので、Pukiwiki API にほしいです。 //referred lib/auth.php#basic_auth function is_edit_auth($page, $user = '') { global $edit_auth, $edit_auth_pages, $auth_method_type; if (! $edit_auth) { return FALSE; } // Checked by: $target_str = ''; if ($auth_method_type == 'pagename') { $target_str = $page; // Page name } else if ($auth_method_type == 'contents') { $target_str = join('', get_source($page)); // Its contents } foreach($edit_auth_pages as $regexp => $users) { if (preg_match($regexp, $target_str)) { if ($user == '' || in_array($user, explode(',', $users))) { return TRUE; } } } return FALSE; } is_read_auth もあったほうがいいとは思います((1.4.7 前に言えればよかったナァ))。 -------- - lib/auth.phpのcheck_editable, check_readableで代替可能かと思われます。 -- [[Ratbeta]] &new{2006-06-25 (日) 17:03:34}; - いいえ、check_editable は basic_auth を表示してしまいます。 -- [[sonots]] &new{2006-06-26 (月) 16:18:53}; -- パスワードを要求するものと、要求しないものの違いです。前述の通り is_freeze のような関数となります。 -- [[sonots]] &new{2006-06-26 (月) 16:20:49}; #comment