static void Main(string[] args) { var couchbaseConfig = new Couchbase.Configuration.CouchbaseClientConfiguration(); couchbaseConfig.Bucket = "larm"; couchbaseConfig.Urls.Add(new Uri("http://10.0.252.63:8091/pools")); var cache = new Cache(new Couchbase.CouchbaseClient(couchbaseConfig)); var portalRepository = new PortalRepository().WithConfiguration("user id=larm-app;password=0n44Fx4f4m2jNtuLuA6ym88mr3h40D;server=mysql01.cpwvkgghf9fg.eu-west-1.rds.amazonaws.com;persist security info=True;database=larm-portal;Allow User Variables=True;CharSet=utf8;"); var portal = new PortalApplication(cache, new ViewManager(new Dictionary<string, IView>(), cache), portalRepository, new DatabaseLoggerFactory(portalRepository)); var mcm = new McmModule(); mcm.Load(portal); const uint PageSize = 100; var indexedCount = 0; for (uint i = 0; ; i++) { var objects = mcm.McmRepository.ObjectGet(null, i, PageSize, true, true, true, true, true, null); portal.ViewManager.GetView("Search").Index(objects); portal.ViewManager.GetView("Object").Index(objects); Console.SetCursorPosition(0,Console.CursorTop); Console.Write("Objects indexed: {0}", ++indexedCount); if (objects.Count != PageSize) break; } }
public MigrationContext( MigrationSettings settings, OrmPackage package, PortalApplication portal, BundleManifest manifest, IVSProject vsProject, CodeDomProvider codeProvider, StrongNameKeyPair keyPair, IExtendedLog log, IOperationStatus status, ICollection<Plugin> plugins) { _settings = settings; _package = package; _portal = portal; _manifest = manifest; _vsProject = vsProject; _codeProvider = codeProvider; _keyPair = keyPair; _log = log; _status = status; _plugins = plugins; _forms = new Dictionary<string, FormInfo>(StringComparer.InvariantCultureIgnoreCase); _mainViews = new Dictionary<string, MainViewInfo>(StringComparer.InvariantCultureIgnoreCase); _navigation = new List<NavigationInfo>(); _scripts = new Dictionary<string, ScriptInfo>(StringComparer.InvariantCultureIgnoreCase); _tables = new Dictionary<string, TableInfo>(StringComparer.InvariantCultureIgnoreCase); _entities = new Dictionary<string, OrmEntity>(StringComparer.InvariantCultureIgnoreCase); _relationships = new Dictionary<DataPathJoin, RelationshipInfo>(); _linkedFiles = new List<LinkedFile>(); _localizedStrings = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); _references = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); _smartParts = new List<SmartPartMapping>(); _secondaryJoins = new Dictionary<DataPathJoin, DataPathJoin>(); }
public void Load() { var module = new CockpitModule(); module.Load(PortalApplication.Object); PortalApplication.Verify(m => m.MapRoute("/v6/Question", It.IsAny <Func <IExtension> >())); PortalApplication.Verify(m => m.MapRoute("/v6/Answer", It.IsAny <Func <IExtension> >())); PortalApplication.Verify(m => m.MapRoute("/v6/Selection", It.IsAny <Func <IExtension> >())); }
public QuickDeploy(DeploymentTarget target, DeploymentTargetPortal targetPortal, UIWorkItem workItem) { _workItem = workItem; _target = target; _targetPortal = targetPortal; var projectContext = ApplicationContext.Current.Services.Get<IProjectContextService>(true); var portalModel = projectContext.ActiveProject.Models.Get<PortalModel>(); Guid portalId = new Guid(_targetPortal.InstanceId); _portal = portalModel.PortalApplications.FirstOrDefault(portal => portal.Id == portalId); if (_portal == null) throw new Exception(string.Format("Could not find portal application by Id: {0}", portalId)); _worker = new BackgroundWorker(); _worker.WorkerReportsProgress = true; _worker.DoWork += (sender, e) => InternalDeploy(); }
private static void Index() { Console.Clear(); var cache = new Cache(new Couchbase.CouchbaseClient()); var portalRepository = new PortalRepository().WithConfiguration( System.Configuration.ConfigurationManager.ConnectionStrings["Portal"].ConnectionString); var portal = new PortalApplication(cache, new ViewManager(new Dictionary<string, IView>(), cache), portalRepository, new DatabaseLoggerFactory(portalRepository)); var mcm = new McmModule(); var larm = new LarmModule(); portal.AddModule(mcm); portal.AddModule(larm); Thread.Sleep(10000); const uint PageSize = 100; var indexedCount = 0; var retrievedCount = 0; uint folderId = 0; Console.WriteLine("Enter folderId (leave blank for all):"); uint.TryParse(Console.ReadLine(), out folderId); var t1 = new Stopwatch(); for (uint i = 0; ; i++) { t1.Reset(); t1.Start(); IList<Chaos.Mcm.Data.Dto.Object> objects = new List<Object>(); if(folderId == 0) objects = mcm.McmRepository.ObjectGet(null, i, PageSize, true, true, true, true, true).ToList(); if(folderId > 0) objects = mcm.McmRepository.ObjectGet(folderId, i, PageSize, true, true, true, true, true).ToList(); Write(0, 1, String.Format("ObjectGet time: {0}", t1.Elapsed)); retrievedCount += objects.Count; new Thread(() => { var objs = objects; var t2 = new Stopwatch(); t2.Start(); try { portal.ViewManager.Index(objs); } catch (Exception) { Thread.Sleep(30000); portal.ViewManager.Index(objs); } Write(0, 2, String.Format("Index time: {0}", t2.Elapsed)); t2.Restart(); indexedCount += 100; Write(0, 5, String.Format("Objects indexed: {0}", indexedCount)); }).Start(); Write(0, 4, String.Format("Objects retrieved: {0}", retrievedCount)); if (objects.Count != PageSize) break; } }
public void loadGroupsAndCookie(HttpContext context, int cookieTimeoutMinutes, bool persistCookie, PortalApplication portalApp) { // -- Retrieve the user's groups WebPortalUser user = WebPortalUser.FetchUser(_un, portalApp); WebPortalUserRole[] Roles = user.userRoles; string groups = ""; for (int i = 0; i < Roles.Length; i++) { WebPortalUserRole role = Roles[i]; groups = groups + role.Name; if (i < Roles.Length - 1) { groups = groups + groupDelimiter; } } // for // -- Create the authetication ticket FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, // version _un, DateTime.Now, DateTime.Now.AddMinutes(cookieTimeoutMinutes), persistCookie, groups); // Now encrypt the ticket. string encryptedTicket = FormsAuthentication.Encrypt(authTicket); // Create a cookie and add the encrypted ticket to the // cookie as data. HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); if (authTicket.IsPersistent) { authCookie.Expires = authTicket.Expiration; } Console.Write(authCookie.Path); Console.Write(authCookie.Domain); // Add the cookie to the outgoing cookies collection. context.Response.Cookies.Add(authCookie); } // loadGroupsAndCookie
public bool CheckAuthentication(HttpContext context, string requiredRoleName, PortalApplication portalApp) { if (WebPortalUser.CheckLogin(_un, _pw, portalApp)) { WebPortalUser u = WebPortalUser.FetchUser(_un, portalApp); bool b = u.inRole(requiredRoleName); if (b) { u.SetLastLoginInDatabaseToNow(); return(true); } } return(false); }
public bool CheckAuthentication(HttpContext context, PortalApplication portalApp) { return(WebPortalUser.CheckLogin(_un, _pw, portalApp)); }
/// <summary> /// if the user is in any one of the validRoleNames, authentication will proceed. /// </summary> /// <param name="context"></param> /// <param name="validRoleNames"></param> /// <returns></returns> public bool CheckAuthentication(HttpContext context, string[] validRoleNames, PortalApplication portalApp) { var IsValid = false; if (WebPortalUser.CheckLogin(_un, _pw, portalApp)) { WebPortalUser u = WebPortalUser.FetchUser(_un, portalApp); foreach (string requiredRoleName in validRoleNames) { bool b = u.inRole(requiredRoleName); if (b) { Roles.Add(requiredRoleName); IsValid = true; } } if (IsValid) { u.SetLastLoginInDatabaseToNow(); return(true); } } return(false); }
internal QuickPageGenerationProvider(QuickPageGenerator generator, PortalPage page, PortalApplication portal) : base(portal) { _gen = generator; _page = page; }