コード例 #1
0
        //Event to Save Users and the corresponding roles
        //There is no way we can append the current user to the existing users list, we have to save them all once again
        private void SaveUsers()
        {
            Policy[] eachPolicy = new Policy[userpermissionsGridview.Rows.Count];
                int i = 0;
                int j = 0;

                foreach (DataGridViewRow dgvr in userpermissionsGridview.Rows)
                {
                    Policy currentPolicy = new Policy();
                    currentPolicy.GroupUserName = dgvr.Cells[0].Value.ToString();

                    j = 0;
                    foreach (DataGridViewCell dgvc in dgvr.Cells)
                    {
                        if (dgvc.FormattedValue.ToString() == "True")
                        {
                            j++;
                        }
                    }

                    Role[] roles = new Role[j];
                    j = 0;
                    foreach (DataGridViewCell dgvc in dgvr.Cells)
                    {
                        Role currentRole = new Role();
                        if (dgvc.FormattedValue.ToString() == "True")
                        {
                            currentRole.Name = dgvc.OwningColumn.Name;
                            roles[j] = currentRole;
                            j++;
                        }
                    }

                    currentPolicy.Roles = roles;
                    eachPolicy[i] = currentPolicy;
                    i++;
                }

            //This method call with save all the users and the corresponding roles to the current report item.
                m_rs.SetPolicies(m_strPath, eachPolicy);
        }
コード例 #2
0
 //Returns Roles specified in the ReportServer DB
 public Role[] ReturnRoles()
 {
     Role[] roles = new Role[1];
     roles = m_rs.ListRoles(SecurityScopeEnum.Catalog);
     return roles;
 }