public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto) { AuthenticateAttribute.AuthenticateIfBasicAuth(req, res); var session = req.GetSession(); if (HasAllPermissions(req, session)) { return; } res.StatusCode = (int)HttpStatusCode.Unauthorized; res.StatusDescription = "Invalid Permissions"; res.EndServiceStackRequest(); }
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto) { AuthenticateAttribute.AuthenticateIfBasicAuth(req, res); var session = req.GetSession(); if (HasAllRoles(req, session)) { return; } res.StatusCode = session != null && session.IsAuthenticated ? (int)HttpStatusCode.Forbidden : (int)HttpStatusCode.Unauthorized; res.StatusDescription = "Invalid Role"; res.EndServiceStackRequest(); }