protected override bool CheckSecurity() { if (!base.CheckSecurity()) { return(false); } if (ConciergeAPI.HasBackgroundConsoleUser) { return(true); } if (targetEvent.SafeGetValue <bool>("InviteOnly") && !EventLogic.IsInvited(targetEvent.ID, targetEntity.ID)) { return(false); } if (targetEntity.ID == ConciergeAPI.CurrentEntity.ID) { return(true); } if (targetChapter != null) { return(targetEvent.VisibleInPortal && canManageEvents(targetChapter.Leaders)); } if (targetSection != null) { return(targetEvent.VisibleInPortal && canManageEvents(targetSection.Leaders)); } if (targetOrganizationalLayer != null) { return(targetEvent.VisibleInPortal && canManageEvents(targetOrganizationalLayer.Leaders)); } var mode = Request.QueryString["mode"]; if (mode == "group" && targetEntity.ID == ConciergeAPI.CurrentEntity.ID) { return(true); } //Default to false for now because currently only leaders can create events in the portal return(false); }
protected override bool CheckSecurity() { if (!base.CheckSecurity()) { return(false); } if (targetEvent.SafeGetValue <bool>("InviteOnly") && (ConciergeAPI.CurrentEntity == null || !EventLogic.IsInvited(targetEvent.ID, ConciergeAPI.CurrentEntity.ID))) { return(false); } if (ConciergeAPI.HasBackgroundConsoleUser) { return(true); } return(targetEvent.VisibleInPortal); }
public static List <string> GetEntitiesEligibleForGroupRegistration(msEvent targetEvent, msEntity currentEntity, IConciergeAPIService api) { if (targetEvent == null) { throw new ArgumentNullException("targetEvent"); } if (api == null) { throw new ArgumentNullException("api"); } List <string> applicableRelationshipTypes = targetEvent.SafeGetValue <List <string> >("GroupRegistrationRelationshipTypes"); if (applicableRelationshipTypes == null || applicableRelationshipTypes.Count == 0) { return(null); // there are no registration types enabled } if (currentEntity == null) { return(null); } List <string> entities = new List <string>(); if (currentEntity.ClassType == msOrganization.CLASS_NAME) // an organization can always manage themselves { entities.Add(currentEntity.ID); return(entities); } // OK, let's see if this person is linked to any companies Search s = new Search("RelationshipsForARecord"); s.Context = currentEntity.ID; s.AddCriteria(Expr.Equals("IsLeftSide", false)); // the right side of the relationship is the individual // MSIV-5 Indivdiuals with expired relationships should not be eligible for Event Group Registration var sog1 = new SearchOperationGroup { GroupType = SearchOperationGroupType.Or }; sog1.Criteria.Add(Expr.Equals(msRelationship.FIELDS.StartDate, null)); sog1.Criteria.Add(Expr.IsLessThanOrEqual(msRelationship.FIELDS.StartDate, DateTime.Today.Date)); s.AddCriteria(sog1); var sog2 = new SearchOperationGroup { GroupType = SearchOperationGroupType.Or }; sog2.Criteria.Add(Expr.Equals(msRelationship.FIELDS.EndDate, null)); sog2.Criteria.Add(Expr.IsGreaterThan(msRelationship.FIELDS.EndDate, DateTime.Today.Date)); s.AddCriteria(sog2); // now, we do an is one of the follow for relationship types IsOneOfTheFollowing isTypes = new IsOneOfTheFollowing { FieldName = "Type_ID" }; isTypes.ValuesToOperateOn = new List <object>(applicableRelationshipTypes); s.AddCriteria(isTypes); s.AddOutputColumn("Target_ID"); var values = api.GetSearchResult(s, 0, null).Table; foreach (DataRow dr in values.Rows) { entities.Add(Convert.ToString(dr["Target_ID"])); } // keep in mind we may have orphaned relationships, so we have to make sure each org ID exists! return(entities.Distinct().ToList()); }