Skip to content

Commit

Permalink
small refactoring in premissions related to zone and superuser check
Browse files Browse the repository at this point in the history
  • Loading branch information
tvatavuk committed Sep 19, 2018
1 parent c86abc3 commit 7d3963d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .vs/config/applicationhost.config
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@
<binding protocol="http" bindingInformation="*:20088:localhost" />
</bindings>
</site>
<site name="2sxc(3)" id="9">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:3329:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
Expand Down
4 changes: 2 additions & 2 deletions Sxc WebApi/Permissions/MultiPermissionsApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override Dictionary<string, IPermissionCheck> InitializePermissionChec
{"App", BuildPermissionChecker()}
};

public override bool ZoneChangedAndNotSuperUser(out HttpResponseException exp)
public override bool ZoneAsInContextOrSuperUser(out HttpResponseException exp)
{
var wrapLog = Log.Call("ZoneChangedAndNotSuperUser()");
var zoneSameOrSuperUser = SamePortal || PortalSettings.Current.UserInfo.IsSuperUser;
Expand All @@ -57,7 +57,7 @@ public override bool ZoneChangedAndNotSuperUser(out HttpResponseException exp)

wrapLog(zoneSameOrSuperUser ? $"sameportal:{SamePortal} - ok": "not ok, generate error");

return !zoneSameOrSuperUser;
return zoneSameOrSuperUser;
}


Expand Down
4 changes: 2 additions & 2 deletions Sxc WebApi/Permissions/MultiPermissionsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected MultiPermissionsBase(string logName, Log parentLog) : base(logName, pa

protected abstract Dictionary<string, IPermissionCheck> InitializePermissionChecks();

public abstract bool ZoneChangedAndNotSuperUser(out HttpResponseException exp);
public abstract bool ZoneAsInContextOrSuperUser(out HttpResponseException exp);

#endregion

Expand Down Expand Up @@ -80,7 +80,7 @@ protected bool Ensure(List<Grants> grants, KeyValuePair<string, IPermissionCheck

public bool SameAppOrIsSuperUserAndEnsure(List<Grants> grants, out HttpResponseException preparedException)
{
if (!ZoneChangedAndNotSuperUser(out preparedException))
if (!ZoneAsInContextOrSuperUser(out preparedException))
return false;
if (!Ensure(grants, out preparedException))
return false;
Expand Down
2 changes: 1 addition & 1 deletion Sxc WebApi/SystemController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void App(int zoneId, string name)
public dynamic DialogSettings(int appId)
{
var appAndPerms = new MultiPermissionsApp(SxcInstance, appId, Log);
if (appAndPerms.ZoneChangedAndNotSuperUser(out var exp))
if (!appAndPerms.ZoneAsInContextOrSuperUser(out var exp))
throw exp;

//var appIdentity = new AppPermissionBeforeUsing(SxcInstance, Log)
Expand Down

0 comments on commit 7d3963d

Please sign in to comment.