//the below function is to display the final query for public void dgvFolderSecurity(List <FolderSecurity> qFolderSecurity, DataGridView dgv, Label label4) { //columns for the datagridview foreach (String s in this.fieldsFolderSecurity) { DataGridViewColumn col = new DataGridViewTextBoxColumn(); col.HeaderText = s; dgv.Columns.Add(col); } //Add a row and fill it with the query for (int j = 0; j < qFolderSecurity.Count; j++) { int index = dgv.Rows.Add(); FolderSecurity fs = qFolderSecurity.ElementAt(j); dgv.Rows[j].Cells[0].Value = fs.folderId; dgv.Rows[j].Cells[1].Value = fs.folderName; dgv.Rows[j].Cells[2].Value = fs.type; dgv.Rows[j].Cells[3].Value = fs.name; dgv.Rows[j].Cells[4].Value = fs.accessType; } label4.Text = "Done"; }
private void Save() { List <FolderSecurity.SecurityIdentifierAndFolderRights> list = new List <FolderSecurity.SecurityIdentifierAndFolderRights>(this.tableEntries.Count); foreach (AclTableEntry aclTableEntry in this.tableEntries) { list.Add(new FolderSecurity.SecurityIdentifierAndFolderRights(aclTableEntry.SecurityIdentifier, (FolderSecurity.ExchangeFolderRights)aclTableEntry.MemberRights, aclTableEntry.IsGroup ? FolderSecurity.SecurityIdentifierType.Group : FolderSecurity.SecurityIdentifierType.User)); aclTableEntry.MemberRights = (MemberRights)FolderSecurity.NormalizeFolderRights((FolderSecurity.ExchangeFolderRights)aclTableEntry.MemberRights); } byte[] array = AclModifyTable.SerializeTableEntries(this.tableEntries); RawAcl rawAcl = FolderSecurity.AnnotatedAceList.BuildFolderCanonicalAceList(list); if (this.securityDescriptor != null) { this.securityDescriptor.DiscretionaryAcl = rawAcl; } else { this.securityDescriptor = FolderSecurity.AclTableAndSecurityDescriptorProperty.CreateFolderSecurityDescriptor(rawAcl).ToRawSecurityDescriptorThrow(); } RawAcl rawAcl2 = FolderSecurity.AnnotatedAceList.BuildFreeBusyCanonicalAceList(list); if (this.freeBusySecurityDescriptor != null) { this.freeBusySecurityDescriptor.DiscretionaryAcl = rawAcl2; } else if ((this.options & ModifyTableOptions.FreeBusyAware) == ModifyTableOptions.FreeBusyAware) { this.freeBusySecurityDescriptor = FolderSecurity.AclTableAndSecurityDescriptorProperty.CreateFolderSecurityDescriptor(rawAcl2).ToRawSecurityDescriptorThrow(); } Dictionary <SecurityIdentifier, FolderSecurity.SecurityIdentifierType> dictionary = new Dictionary <SecurityIdentifier, FolderSecurity.SecurityIdentifierType>(list.Count); foreach (FolderSecurity.SecurityIdentifierAndFolderRights securityIdentifierAndFolderRights in list) { if (dictionary.ContainsKey(securityIdentifierAndFolderRights.SecurityIdentifier)) { throw new InvalidParamException(new LocalizedString(string.Format("SID {0} is not unique.", securityIdentifierAndFolderRights.SecurityIdentifier))); } dictionary.Add(securityIdentifierAndFolderRights.SecurityIdentifier, securityIdentifierAndFolderRights.SecurityIdentifierType); } FolderSecurity.AclTableAndSecurityDescriptorProperty aclTableAndSD = new FolderSecurity.AclTableAndSecurityDescriptorProperty(new ArraySegment <byte>(array), dictionary, SecurityDescriptor.FromRawSecurityDescriptor(this.securityDescriptor), SecurityDescriptor.FromRawSecurityDescriptor(this.freeBusySecurityDescriptor)); this.coreFolder.OnBeforeFolderSave(); AclModifyTable.WriteFolderAclTable(this.coreFolder, AclModifyTable.SerializeAclTableAndSecurityDecscriptor(aclTableAndSD)); this.coreFolder.OnAfterFolderSave(); }
private async void FolderShare_Click(object sender, EventArgs e) { label4.Text = "Processing, please wait"; progressBar1.Value = 0; progressBar1.Visible = true; dgv.Rows.Clear(); dgv.Refresh(); SaleForceConnect con = SaleForceConnect.getInstance(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["Password"], ConfigurationManager.AppSettings["ServerURLsoap"]); SforceService connection = con.getCon();// private connection. //clear columns //dgv.Columns.Clear(); //clear rows //dgv.Rows.Clear(); DataGridViewHandler dgvFS = new DataGridViewHandler(); FolderSecurity fs = new FolderSecurity(); ////////////////////////////method that retrieve a list with FolderSecurity information for the dgv\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ /************loading private and public reports and dashboard******************/ int param; if (Int32.TryParse(publicParams.Text, out param)) { param = Convert.ToInt32(publicParams.Text); } else { param = 0; } PrivateReportFactory prf = new PrivateReportFactory(connection); await Task.Factory.StartNew(() => prf.loadPrivateReport()).ContinueWith(t => progressBar1.Value += 25, TaskScheduler.FromCurrentSynchronizationContext()); PublicReportFactory pr = new PublicReportFactory(connection); await Task.Factory.StartNew(() => pr.loadPublicReport(param)).ContinueWith(t => progressBar1.Value += 25, TaskScheduler.FromCurrentSynchronizationContext()); PublicDashboardFactory pdf = new PublicDashboardFactory(connection); await Task.Factory.StartNew(() => pdf.loadPublicDashboard()).ContinueWith(t => progressBar1.Value += 25, TaskScheduler.FromCurrentSynchronizationContext()); PrivateDashboardFactory prdf = new PrivateDashboardFactory(connection); await Task.Factory.StartNew(() => prdf.loadPrivateDashboard()); /************loading Folders and FolderShare********************************/ Rootobject rObjFolders = new Rootobject(); Rootobject rObjFolders2 = new Rootobject(); RootobjectShares rObjectShares = new RootobjectShares(); List <string> folderIdList = new List <string>(); IDictionary <String, List <FolderShare> > mappingFolderIdAndShares = new Dictionary <String, List <FolderShare> >(); //List<FolderShare> fsList = new List<FolderShare>(); folderIdList = await rObjFolders.GetFolderIdAsync(); mappingFolderIdAndShares = await rObjectShares.GetFolderShareListAsync(folderIdList); rObjFolders2 = await Rootobject.GetFoldersAsync(); /******************Query for the final report*******************************/ List <FolderSecurity> qFolderSecurity = new List <FolderSecurity>(); ListasSfCollectionObjects fsq = new ListasSfCollectionObjects(); qFolderSecurity = fsq.QueryFolderSecurity(pr.getPublicReport(), prf.getPrivateReport(), pdf.GetPublicDashboards(), prdf.GetPrivateDashboards(), mappingFolderIdAndShares, rObjFolders2); //await Task.Factory.StartNew(() => dgvFS.dgvFolderSecurity(qFolderSecurity, dgv, label4).ContinueWith(t => progressBar1.Value += 25, TaskScheduler.FromCurrentSynchronizationContext())); dgvFS.dgvFolderSecurity(qFolderSecurity, dgv, label4); progressBar1.Value += 25; buttonFolderShareWasClicked = true; }