Authority checks for org/geo combo

This commit is contained in:
Rick Falkvinge
2015-05-02 12:19:09 +02:00
parent a190e36fe8
commit 8b11b72d4d
2 changed files with 17 additions and 3 deletions
+15 -1
View File
@@ -39,8 +39,22 @@ namespace Swarmops.Frontend.Automation
{
throw new UnauthorizedAccessException();
}
if (!authData.Authority.HasAccess (new Access (AccessAspect.Administration)))
if (position.PositionLevel == PositionLevel.SystemWide && !authData.Authority.HasAccess (new Access (AccessAspect.Administration)))
{
// Authority check for systemwide
throw new UnauthorizedAccessException();
}
if ((position.GeographyId == Geography.RootIdentity || position.GeographyId == 0) &&
!authData.Authority.HasAccess (new Access (authData.CurrentOrganization, AccessAspect.Administration)))
{
// Authority check for org-global
throw new UnauthorizedAccessException();
}
if (
!authData.Authority.HasAccess (new Access (authData.CurrentOrganization, geography,
AccessAspect.Administration)))
{
// Authority check for org/geo combo
throw new UnauthorizedAccessException();
}
+2 -2
View File
@@ -45,9 +45,9 @@ namespace Swarmops.Frontend.Pages.v5.Admin
if (orgPositions.Count == 0)
{
// not initalized. Initialize.
// not initalized. Initialize. Assume nonprofit.
Positions.CreateOrganizationDefaultPositions (CurrentOrganization);
Positions.CreateOrganizationDefaultPositions (CurrentOrganization, PositionTitle.Nonprofit);
}