Esempio n. 1
0
        public void ToStringSerialisesAllValues()
        {
            DiagnoseSecurityRequest request = new DiagnoseSecurityRequest();

            request.Identifier   = "identifier";
            request.UserName     = "******";
            request.ServerName   = "serverName";
            request.SessionToken = "sessionToken";
            request.SourceName   = "sourceName";
            request.Timestamp    = DateTime.Now;
            request.Projects.Add("test project");
            string actual   = request.ToString();
            string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<diagnoseSecurityMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
                                            "timestamp=\"{4:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" server=\"{1}\" source=\"{2}\" session=\"{3}\" userName=\"{5}\">" +
                                            "<project>test project</project>" +
                                            "</diagnoseSecurityMessage>",
                                            request.Identifier,
                                            request.ServerName,
                                            request.SourceName,
                                            request.SessionToken,
                                            request.Timestamp,
                                            request.UserName);

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void GetSetAllPropertiesWorks()
        {
            DiagnoseSecurityRequest request = new DiagnoseSecurityRequest();

            request.UserName = "******";
            Assert.AreEqual("new user", request.UserName, "UserName fails the get/set test");
            var projects = new List <string>();

            request.Projects = projects;
            Assert.AreSame(projects, request.Projects);
        }
Esempio n. 3
0
        public void ToStringSerialisesDefaultValues()
        {
            DiagnoseSecurityRequest request = new DiagnoseSecurityRequest();
            string actual   = request.ToString();
            string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<diagnoseSecurityMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
                                            "timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" source=\"{1}\" />",
                                            request.Identifier,
                                            request.SourceName,
                                            request.Timestamp);

            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Checks the security permissions for a user against one or more projects.
        /// </summary>
        /// <returns>A set of diagnostics information.</returns>
        public override List <SecurityCheckDiagnostics> DiagnoseSecurityPermissions(string userName, params string[] projects)
        {
            DiagnoseSecurityRequest request = new DiagnoseSecurityRequest();

            request.SessionToken = SessionToken;
            request.ServerName   = TargetServer;
            request.UserName     = userName;
            request.ServerName   = TargetServer;
            if (projects != null)
            {
                request.Projects.AddRange(projects);
            }
            DiagnoseSecurityResponse resp = ValidateResponse(
                connection.SendMessage("DiagnoseSecurityPermissions", request))
                                            as DiagnoseSecurityResponse;

            return(resp.Diagnostics);
        }
 /// <summary>
 /// Checks the security permissions for a user against one or more projects.
 /// </summary>
 /// <param name="request"></param>
 /// <returns>A set of diagnostics information.</returns>
 public DiagnoseSecurityResponse DiagnoseSecurityPermissions(DiagnoseSecurityRequest request)
 {
     return(cruiseServer.DiagnoseSecurityPermissions(request));
 }
Esempio n. 6
0
 /// <summary>
 /// Checks the security permissions for a user against one or more projects.
 /// </summary>
 /// <param name="request"></param>
 /// <returns>A set of diagnostics information.</returns>
 public virtual DiagnoseSecurityResponse DiagnoseSecurityPermissions(DiagnoseSecurityRequest request)
 {
     return(server.DiagnoseSecurityPermissions(request));
 }