예제 #1
0
        public static string GetPermissionTypeString(eACLPermissionType type)
        {
            string result;

            switch (type)
            {
            case eACLPermissionType.ePermissionTypeAnyone:
                result = "Anyone";
                break;

            case eACLPermissionType.ePermissionTypeGroup:
                result = "Group";
                break;

            case eACLPermissionType.ePermissionTypeUser:
                result = "User";
                break;

            default:
                result = "Unknown";
                break;
            }

            return(Strings.Localize(result));
        }
예제 #2
0
        private void ListSelectedType()
        {
            eACLPermissionType permType = (eACLPermissionType)comboType.SelectedValue;

            switch (permType)
            {
            case eACLPermissionType.ePermissionTypeUser:
                ListUsers();
                break;

            case eACLPermissionType.ePermissionTypeGroup:
                ListGroups();
                break;

            case eACLPermissionType.ePermissionTypeAnyone:
                ListAnyone();
                break;
            }
        }
예제 #3
0
        public static string GetPermissionTypeString(eACLPermissionType type)
        {
            string result;
             switch (type)
             {
            case eACLPermissionType.ePermissionTypeAnyone:
               result = "Anyone";
               break;
            case eACLPermissionType.ePermissionTypeGroup:
               result = "Group";
               break;
            case eACLPermissionType.ePermissionTypeUser:
               result = "User";
               break;
            default:
               result = "Unknown";
               break;
             }

             return Strings.Localize(result);
        }
예제 #4
0
        private void buttonAddPermission_Click(object sender, EventArgs e)
        {
            SaveRightsForPermission();

            formSelectUsers selectUsersDlg = new formSelectUsers(false, 0);

            if (selectUsersDlg.ShowDialog() == DialogResult.OK)
            {
                listACL.SelectedItems.Clear();


                List <int> selectedItems = selectUsersDlg.GetSelectedIDs();

                eACLPermissionType type = selectUsersDlg.Type;

                if (type == eACLPermissionType.ePermissionTypeAnyone)
                {
                    IMAPFolderPermission permission = _folder.Permissions.Add();
                    permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone;
                    permission.Save();

                    ListViewItem listItem = ListPermission(permission);
                    listItem.Selected = true;
                    listACL.Focus();
                }
                else
                {
                    foreach (int itemID in selectedItems)
                    {
                        IMAPFolderPermission permission = _folder.Permissions.Add();

                        switch (type)
                        {
                        case eACLPermissionType.ePermissionTypeGroup:
                        {
                            permission.PermissionType    = eACLPermissionType.ePermissionTypeGroup;
                            permission.PermissionGroupID = itemID;

                            break;
                        }

                        case eACLPermissionType.ePermissionTypeUser:
                        {
                            permission.PermissionType      = eACLPermissionType.ePermissionTypeUser;
                            permission.PermissionAccountID = itemID;
                            break;
                        }

                        default:
                        {
                            throw new Exception("Trying to add unknown object type to permission list");
                        }
                        }

                        permission.Save();

                        ListViewItem listItem = ListPermission(permission);
                        listItem.Selected = true;
                        listACL.Focus();
                    }
                }
            }
        }