REFACTOR: Renamed a bunch of 'Membership' to 'Participation'
This commit is contained in:
@@ -29,14 +29,14 @@ namespace Swarmops.Interface
|
||||
bool isMember = false;
|
||||
foreach (Organization org1 in organizations)
|
||||
{
|
||||
if (person.MemberOf(org1)) isMember = true;
|
||||
if (person.ParticipatesInOrganization(org1)) isMember = true;
|
||||
}
|
||||
|
||||
if (!isMember)
|
||||
{
|
||||
// if he/she used to be a member, use exmember icons
|
||||
|
||||
Memberships memberships = person.GetMemberships(true);
|
||||
Memberships memberships = person.GetParticipations(true);
|
||||
|
||||
foreach (Membership membership in memberships)
|
||||
{
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Swarmops.Logic.Communications
|
||||
OutboundComm comm = OutboundComm.Create(null, null, Organization.Sandbox,
|
||||
null /* resolver */, null,
|
||||
CommTransmitterClass.CommsTransmitterMail,
|
||||
new PayloadEnvelope(new ParticipantMailPayload(customSubject + "|" + sandboxMailAddress, customBody, recipients[0].GetMemberships()[0], recipients[0])).ToXml(),
|
||||
new PayloadEnvelope(new ParticipantMailPayload(customSubject + "|" + sandboxMailAddress, customBody, recipients[0].GetParticipations()[0], recipients[0])).ToXml(),
|
||||
OutboundCommPriority.Low);
|
||||
|
||||
foreach (Person person in recipients)
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace Swarmops.Logic.Communications
|
||||
foreach (BasicPerson bPerson in msg.People.Values)
|
||||
{
|
||||
person = Person.FromBasic(bPerson);
|
||||
if (person.GetRecentMemberships(Membership.GracePeriod).Count > 0)
|
||||
if (person.GetRecentParticipations(Membership.GracePeriod).Count > 0)
|
||||
{
|
||||
countOfMembers++;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Swarmops.Logic.Security
|
||||
|
||||
bool hasActiveMemberships = false;
|
||||
|
||||
Participations participations = candidate.GetMemberships();
|
||||
Participations participations = candidate.GetParticipations();
|
||||
|
||||
foreach (Participation membership in participations)
|
||||
{
|
||||
@@ -331,7 +331,7 @@ namespace Swarmops.Logic.Security
|
||||
links += "\r\n\r\n";
|
||||
links += "#" + p.PersonId;
|
||||
links += " [Member of:";
|
||||
Participations msList = p.GetMemberships();
|
||||
Participations msList = p.GetParticipations();
|
||||
foreach (Participation ms in msList)
|
||||
{
|
||||
++membershipCount;
|
||||
@@ -504,7 +504,7 @@ namespace Swarmops.Logic.Security
|
||||
string links = "";
|
||||
foreach (Person p in candidatePeople)
|
||||
{
|
||||
Participations msList = p.GetMemberships();
|
||||
Participations msList = p.GetParticipations();
|
||||
if (msList.Count == 0 && p.IsActivist)
|
||||
{
|
||||
personIsActivist = true;
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Swarmops.Logic.Security
|
||||
{
|
||||
// Check that a membership (or whatever this org calls it) exists, for this org or a parentline org
|
||||
|
||||
if (Person.MemberOfWithInherited(access.Organization))
|
||||
if (Person.ParticipatesInOrganizationOrParent(access.Organization))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -462,7 +462,7 @@ namespace Swarmops.Logic.Security
|
||||
{
|
||||
// Still filter to the current Organization, even though we have systemwide access
|
||||
|
||||
if (person.MemberOfWithInherited(Organization))
|
||||
if (person.ParticipatesInOrganizationOrParent(Organization))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ namespace Swarmops.Logic.Security
|
||||
if (
|
||||
HasAccess (new Access (Organization, aspect, AccessType.Read)))
|
||||
{
|
||||
if (person.MemberOfWithInherited (Organization))
|
||||
if (person.ParticipatesInOrganizationOrParent (Organization))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -490,7 +490,7 @@ namespace Swarmops.Logic.Security
|
||||
if (
|
||||
HasAccess (new Access (Organization, Position.Geography, aspect, AccessType.Read)))
|
||||
{
|
||||
if (person.MemberOfWithInherited(Organization))
|
||||
if (person.ParticipatesInOrganizationOrParent(Organization))
|
||||
{
|
||||
if (person.GeographyId == Position.GeographyId || person.Geography.Inherits (Position.Geography))
|
||||
{
|
||||
|
||||
@@ -449,7 +449,7 @@ namespace Swarmops.Logic.Special.Sweden
|
||||
|
||||
bool hasActiveMemberships = false;
|
||||
|
||||
Participations participations = person.GetMemberships();
|
||||
Participations participations = person.GetParticipations();
|
||||
|
||||
foreach (Participation membership in participations)
|
||||
{
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace Swarmops.Logic.Special.Sweden
|
||||
Person[] array = people.ToArray();
|
||||
foreach (Person testPerson in array)
|
||||
{
|
||||
if (testPerson.GetMemberships().Count == 0)
|
||||
if (testPerson.GetParticipations().Count == 0)
|
||||
{
|
||||
people.Remove (testPerson);
|
||||
}
|
||||
@@ -853,7 +853,7 @@ namespace Swarmops.Logic.Special.Sweden
|
||||
Person[] array = people.ToArray();
|
||||
foreach (Person testPerson in array)
|
||||
{
|
||||
if (testPerson.GetMemberships().Count == 0)
|
||||
if (testPerson.GetParticipations().Count == 0)
|
||||
{
|
||||
people.Remove (testPerson);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Swarmops.Logic.Special.Sweden
|
||||
{
|
||||
person.SwedishForumAccountId = newHandleAccountId;
|
||||
|
||||
if (newHandleAccountId != 0 && person.MemberOf(Organization.PPSEid) )
|
||||
if (newHandleAccountId != 0 && person.ParticipatesInOrganization(Organization.PPSEid) )
|
||||
{
|
||||
SwedishForumDatabase.GetDatabase().SetPartyMember(newHandleAccountId);
|
||||
}
|
||||
|
||||
+23
-23
@@ -403,7 +403,7 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
//not set, make a guess...
|
||||
|
||||
foreach (Participation ms in GetMemberships (false))
|
||||
foreach (Participation ms in GetParticipations (false))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -622,17 +622,17 @@ namespace Swarmops.Logic.Swarm
|
||||
}
|
||||
|
||||
|
||||
public Participations GetMemberships (bool includeTerminated)
|
||||
public Participations GetParticipations (bool includeTerminated)
|
||||
{
|
||||
if (!includeTerminated)
|
||||
{
|
||||
return GetMemberships();
|
||||
return GetParticipations();
|
||||
}
|
||||
|
||||
return Participations.FromArray (SwarmDb.GetDatabaseForReading().GetParticipations (this));
|
||||
}
|
||||
|
||||
public Participations GetMemberships()
|
||||
public Participations GetParticipations()
|
||||
{
|
||||
return
|
||||
Participations.FromArray (SwarmDb.GetDatabaseForReading()
|
||||
@@ -646,11 +646,11 @@ namespace Swarmops.Logic.Swarm
|
||||
/// <param name="gracePeriod">For exired, number of days to add to allow it to be returned</param>
|
||||
/// <param name="orgId"></param>
|
||||
/// <returns></returns>
|
||||
public Participation GetRecentMembership (int gracePeriod, int orgId)
|
||||
public Participation GetRecentParticipation (int gracePeriod, int orgId)
|
||||
{
|
||||
List<int> orgIdList = new List<int>();
|
||||
orgIdList.Add (orgId);
|
||||
Participations mss = GetRecentMemberships (orgIdList, gracePeriod);
|
||||
Participations mss = GetRecentParticipations (orgIdList, gracePeriod);
|
||||
foreach (Participation ms in mss)
|
||||
{
|
||||
if (ms.OrganizationId == orgId)
|
||||
@@ -664,10 +664,10 @@ namespace Swarmops.Logic.Swarm
|
||||
/// </summary>
|
||||
/// <param name="gracePeriod">For exired, number of days to add to allow it to be returned</param>
|
||||
/// <returns></returns>
|
||||
public Participations GetRecentMemberships (int gracePeriod)
|
||||
public Participations GetRecentParticipations (int gracePeriod)
|
||||
{
|
||||
List<int> orgIdList = new List<int>();
|
||||
return GetRecentMemberships (orgIdList, gracePeriod);
|
||||
return GetRecentParticipations (orgIdList, gracePeriod);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -676,10 +676,10 @@ namespace Swarmops.Logic.Swarm
|
||||
/// <param name="orgs">List of ids. If empty, all orgs</param>
|
||||
/// <param name="gracePeriod">For exired, number of days to add to allow it to be returned</param>
|
||||
/// <returns></returns>
|
||||
public Participations GetRecentMemberships (Organizations orgs, int gracePeriod)
|
||||
public Participations GetRecentParticipations (Organizations orgs, int gracePeriod)
|
||||
{
|
||||
List<int> orgIdList = new List<int> (orgs.Identities);
|
||||
return GetRecentMemberships (orgIdList, gracePeriod);
|
||||
return GetRecentParticipations (orgIdList, gracePeriod);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -688,9 +688,9 @@ namespace Swarmops.Logic.Swarm
|
||||
/// <param name="orgs">List of ids. If empty, all orgs</param>
|
||||
/// <param name="gracePeriod">For exired, number of days to add to allow it to be returned</param>
|
||||
/// <returns></returns>
|
||||
public Participations GetRecentMemberships (List<int> orgs, int gracePeriod)
|
||||
public Participations GetRecentParticipations (List<int> orgs, int gracePeriod)
|
||||
{
|
||||
Participations participations = GetMemberships (true);
|
||||
Participations participations = GetParticipations (true);
|
||||
Dictionary<int, Participation> collectMembers = new Dictionary<int, Participation>();
|
||||
|
||||
participations.Sort (
|
||||
@@ -1036,14 +1036,14 @@ namespace Swarmops.Logic.Swarm
|
||||
return new string (array);
|
||||
}
|
||||
|
||||
public bool MemberOf (Organization organization)
|
||||
public bool ParticipatesInOrganization (Organization organization)
|
||||
{
|
||||
return MemberOf (organization.Identity);
|
||||
return ParticipatesInOrganization (organization.Identity);
|
||||
}
|
||||
|
||||
public bool MemberOf (int orgId)
|
||||
public bool ParticipatesInOrganization (int orgId)
|
||||
{
|
||||
Participations participations = GetMemberships();
|
||||
Participations participations = GetParticipations();
|
||||
|
||||
foreach (Participation membership in participations)
|
||||
{
|
||||
@@ -1056,9 +1056,9 @@ namespace Swarmops.Logic.Swarm
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MemberOfWithInherited (int orgId)
|
||||
public bool ParticipatesInOrganizationOrParent (int orgId)
|
||||
{
|
||||
Participations participations = GetMemberships();
|
||||
Participations participations = GetParticipations();
|
||||
|
||||
foreach (Participation membership in participations)
|
||||
{
|
||||
@@ -1070,9 +1070,9 @@ namespace Swarmops.Logic.Swarm
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MemberOfWithInherited (Organization org)
|
||||
public bool ParticipatesInOrganizationOrParent (Organization org)
|
||||
{
|
||||
return MemberOfWithInherited (org.Identity);
|
||||
return ParticipatesInOrganizationOrParent (org.Identity);
|
||||
}
|
||||
|
||||
/* --- not used, commented out for usage of hardcoded org ids
|
||||
@@ -1082,7 +1082,7 @@ namespace Swarmops.Logic.Swarm
|
||||
int[] partyOrgs = new int[] { Organization.PPSEid, Organization.PPDKid, Organization.PPFIid };
|
||||
foreach (int orgId in partyOrgs)
|
||||
{
|
||||
if (this.MemberOf(orgId))
|
||||
if (this.ParticipatesInOrganization(orgId))
|
||||
{
|
||||
return orgId;
|
||||
}
|
||||
@@ -1196,9 +1196,9 @@ namespace Swarmops.Logic.Swarm
|
||||
public const int OpenLedgersIdentity = -1;
|
||||
|
||||
|
||||
public Participation ParticipationOf(Organization organization)
|
||||
public Participation ParticipationOf (Organization organization)
|
||||
{
|
||||
Participations participations = GetMemberships();
|
||||
Participations participations = GetParticipations();
|
||||
foreach (Participation participation in participations)
|
||||
{
|
||||
if (participation.OrganizationId == organization.Identity)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Security
|
||||
|
||||
private void PopulateRepeater()
|
||||
{
|
||||
Participations participations = CurrentUser.GetMemberships();
|
||||
Participations participations = CurrentUser.GetParticipations();
|
||||
|
||||
List<OrganizationParameters> availableOrganizations = new List<OrganizationParameters>();
|
||||
foreach (Participation membership in participations)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Security
|
||||
suggestedOrganization = null;
|
||||
}
|
||||
|
||||
if (suggestedOrganization == null || !CurrentUser.MemberOf (suggestedOrganization))
|
||||
if (suggestedOrganization == null || !CurrentUser.ParticipatesInOrganization (suggestedOrganization))
|
||||
{
|
||||
// Some work here on PPSE pilot - we want everybody to be able to switch to Sandbox, which is #1
|
||||
// except for in PPSE installation, where it is... #3 or something
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace Swarmops.Pages.Security
|
||||
Authority testAuthority = Authority.FromLogin (authenticatedPerson,
|
||||
Organization.FromIdentity (lastOrgId));
|
||||
|
||||
if (!authenticatedPerson.MemberOfWithInherited (lastOrgId) && !testAuthority.HasSystemAccess (AccessType.Read))
|
||||
if (!authenticatedPerson.ParticipatesInOrganizationOrParent (lastOrgId) && !testAuthority.HasSystemAccess (AccessType.Read))
|
||||
{
|
||||
// If the person doesn't have access to the last organization (anymore), log on to Sandbox
|
||||
// unless first pilot, in which case throw (deny login)
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Swarmops.Pages.Security
|
||||
lastOrgId = Organization.SandboxIdentity;
|
||||
}
|
||||
|
||||
if (!resetPerson.MemberOfWithInherited(lastOrgId))
|
||||
if (!resetPerson.ParticipatesInOrganizationOrParent(lastOrgId))
|
||||
{
|
||||
// If the person doesn't have access to the last organization (anymore), log on to Sandbox
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Swarmops.Utility.BotCode
|
||||
{
|
||||
Person person = role.Person;
|
||||
|
||||
if (person.MemberOf(Organization.PPSE) && person.PartyEmail.Length > 0 && !dupeCheck.ContainsKey(person.Identity))
|
||||
if (person.ParticipatesInOrganization(Organization.PPSE) && person.PartyEmail.Length > 0 && !dupeCheck.ContainsKey(person.Identity))
|
||||
{
|
||||
dupeCheck[person.Identity] = true;
|
||||
|
||||
|
||||
@@ -728,7 +728,7 @@ namespace Swarmops.Utility.BotCode
|
||||
try
|
||||
{
|
||||
person = Person.FromIdentity(newPwEvent.AffectedPersonId);
|
||||
renewedMembership = person.GetRecentMembership(Membership.GracePeriod, newPwEvent.OrganizationId);
|
||||
renewedMembership = person.GetRecentParticipation(Membership.GracePeriod, newPwEvent.OrganizationId);
|
||||
if (renewedMembership != null)
|
||||
foundExisting = true;
|
||||
}
|
||||
@@ -2021,7 +2021,7 @@ namespace Swarmops.Utility.BotCode
|
||||
{
|
||||
Person person = Person.FromIdentity(newEvent.AffectedPersonId);
|
||||
|
||||
if (person.MemberOf(Organization.PPSE) && person.PartyEmail.Length > 0 &&
|
||||
if (person.ParticipatesInOrganization(Organization.PPSE) && person.PartyEmail.Length > 0 &&
|
||||
person.CryptoFingerprint.Length < 4)
|
||||
{
|
||||
PgpKey.Generate(person, Organization.PPSE);
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Swarmops.Utility.BotCode
|
||||
|
||||
// Mail
|
||||
|
||||
Participations personParticipations = person.GetMemberships();
|
||||
Participations personParticipations = person.GetParticipations();
|
||||
Participations participationsToDelete = new Participations();
|
||||
foreach (Participation personMembership in personParticipations)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user