Ejemplo n.º 1
0
        protected void btnSetPermissions_Click(object sender, EventArgs e)
        {
            // create file
            string path = (string)ViewState["EditPermissions"];

            try
            {
                // update permissions
                List <UserPermission> users = new List <UserPermission>();
                foreach (GridViewRow row in gvFilePermissions.Rows)
                {
                    Literal  litAccountName = (Literal)row.FindControl("litAccountName");
                    CheckBox chkRead        = (CheckBox)row.FindControl("chkRead");
                    CheckBox chkWrite       = (CheckBox)row.FindControl("chkWrite");



                    if (litAccountName != null)
                    {
                        UserPermission user = new UserPermission();
                        user.AccountName = litAccountName.Text;
                        user.Read        = chkRead.Checked;
                        user.Write       = chkWrite.Checked;
                        users.Add(user);
                    }
                }

                int result = ES.Services.Files.SetFilePermissions(PanelSecurity.PackageId, path,
                                                                  users.ToArray(), chkReplaceChildPermissions.Checked);
                if (result < 0)
                {
                    messageBox.ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage("FILES_UPDATE_PERMISSIONS", ex);
            }

            // hide form
            PermissionsFileModal.Hide();
        }
Ejemplo n.º 2
0
 protected void btnCancelPermissions_Click(object sender, EventArgs e)
 {
     PermissionsFileModal.Hide();
 }