imap_setacl

(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)

imap_setacl指定したメールボックスの ACL を設定する

説明

imap_setacl(
    IMAP\Connection $imap,
    string $mailbox,
    string $user_id,
    string $rights
): bool

指定したメールボックスの ACL を設定します。

パラメータ

imap

IMAP\Connection クラスのインスタンス。

mailbox

メールボックス名。詳細は imap_open() を参照ください。

警告

信頼できないデータをこのパラメータに渡すのであれば、 imap.enable_insecure_rsh を無効にしておかなければ危険です。

user_id

権限を付与するユーザー。

rights

そのユーザーに付与する権限。空文字列を渡すと、acl を削除します。

戻り値

成功した場合に true を、失敗した場合に false を返します。

変更履歴

バージョン 説明
8.1.0 引数 imap は、IMAP\Connection クラスのインスタンスを期待するようになりました。 これより前のバージョンでは、有効な imap リソース が期待されていました。

注意

この関数は、現在 c-client2000 以降のユーザーのみ使用可能です。

参考

  • imap_getacl() - 与えられたメールボックスの ACL を取得する

add a note add a note

User Contributed Notes 2 notes

up
0
hartmut dot woehrle at hwds dot ch
8 years ago
After getting the ACL's from imap_getacl you want to set them for a user on any mailbox folder like this:

foreach ( $Folders as $key => $Maildir ) {
imap_setacl($domains , "user/john.doe/".$Maildir , $userid, "lrswipkxte");
}

You can use a form that translates the ACLs like the following (thanks to cyradm manual):

  switch ($right) {
      case "read" :  $aclstring = "lrs";
          break;
      case "post" : $aclstring = "lrsp";
          break;
      case "append" : $aclstring = "lrsip";
          break;
      case "write" : $aclstring = "lrswipkxte";
          break;
      case "delete" : $aclstring = "lrxte";
          break;
      case "all" : $aclstring = "lrswipkxte";
          break;
      case "admin" : $aclstring = "lrswipkxtea";
          break;
      case "none" : $aclstring = "";
          break;
  }
up
0
panayotis at yellownetroad dot com
21 years ago
I noticed that using:
imap_setacl ($conn, $mbox, $userid, "")
will act like:
"deleteaclmailbox $mbox $userid"  (remove the ACL on mailbox for userid).
To Top