Example #1
0
 public Models.DatabaseList GetDatabases(string UserName, string Password, string domain = "")
 {
     Models.DatabaseList DatabaseList = new Models.DatabaseList();
     try
     {
         var api = new Requests.ConnectorApi(ConfigurationManager.AppSettings["Square9Api"], domain + @"\" + UserName, Password);
         DatabaseList = api.Requests.UserRequests.GetDatabaseList();
     }
     catch (Exception ex)
     {
         throw new Exception("Unable to return list of Secured Users:  " + ex.Message);
     }
     return(DatabaseList);
 }
Example #2
0
        public Models.License GetLicense(string UserName, string Password, string domain = "")
        {
            Models.License license = new Models.License();
            try
            {
                var api = new Requests.ConnectorApi(ConfigurationManager.AppSettings["Square9Api"], domain + @"\" + UserName, Password);
                license = api.Requests.Licenses.GetLicense();
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to return list of Secured Users:  " + ex.Message);
            }

            return(license);
        }
Example #3
0
        public List <Models.SecurityNode> GetSecuredUsersTree(string domain, string UserName, string Password)
        {
            List <Models.SecurityNode> SecuredUsers = new List <Models.SecurityNode>();

            try
            {
                var api     = new Requests.ConnectorApi(ConfigurationManager.AppSettings["Square9Api"], domain + @"\" + UserName, Password);
                var license = api.Requests.Licenses.GetLicense();
                SecuredUsers = api.Requests.UserRequests.GetUsersAndGroupsTree(license.Token);
                api.Requests.Licenses.ReleaseLicense(license.Token);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to return list of Secured Users:  " + ex.Message);
            }

            return(SecuredUsers);
        }
Example #4
0
        public List <String> GetGroupUsers(String DomainOrServerName, String GroupName, bool domain)
        {
            List <String> Users = new List <String>();

            try
            {
                var api     = new Requests.ConnectorApi(ConfigurationManager.AppSettings["Square9Api"], domain + @"\" + UserName, Password);
                var license = api.Requests.Licenses.GetLicense();
                Users = api.Requests.UserRequests.GetUserGroups(DomainOrServerName, GroupName, domain);
                api.Requests.Licenses.ReleaseLicense(license.Token);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to return list of Secured Users:  " + ex.Message);
            }

            return(Users);
        }
Example #5
0
        public int GetUserArchiveSecurity(String domain, Int32 DatabaseId, Int32 ArchiveId, String User, String UserName, String Password)
        {
            var security = 0;

            try
            {
                var api     = new Requests.ConnectorApi(ConfigurationManager.AppSettings["Square9Api"], domain + @"\" + UserName, Password);
                var license = api.Requests.Licenses.GetLicense();
                security = api.Requests.UserRequests.GetUserArchiveSecurity(DatabaseId, ArchiveId, User, license.Token);
                api.Requests.Licenses.ReleaseLicense(license.Token);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to return list of Secured Users:  " + ex.Message);
            }

            return(security);
        }