Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
steff-mueller committed Jan 20, 2012
2 parents 367fdac + 1e31880 commit 5a071c8
Show file tree
Hide file tree
Showing 53 changed files with 1,621 additions and 772 deletions.
Binary file modified NuGet/ServiceStack.Common/lib/ServiceStack.Common.dll
Binary file not shown.
Binary file modified NuGet/ServiceStack.Common/lib/ServiceStack.Interfaces.dll
Binary file not shown.
6 changes: 6 additions & 0 deletions NuGet/ServiceStack.Common/lib/ServiceStack.Interfaces.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion NuGet/ServiceStack.Common/servicestack.common.nuspec
Expand Up @@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack.Common</id>
<version>3.2.6</version>
<version>3.3.0</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>Opensource .NET and Mono REST Web Services framework</summary>
Expand Down
Binary file modified NuGet/ServiceStack/lib/ServiceStack.RazorEngine.dll
Binary file not shown.
Binary file modified NuGet/ServiceStack/lib/ServiceStack.ServiceInterface.dll
Binary file not shown.
40 changes: 20 additions & 20 deletions NuGet/ServiceStack/lib/ServiceStack.XML

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified NuGet/ServiceStack/lib/ServiceStack.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion NuGet/ServiceStack/servicestack.nuspec
Expand Up @@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack</id>
<version>3.2.6</version>
<version>3.3.0</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>Opensource .NET and Mono REST Web Services framework</summary>
Expand Down
6 changes: 6 additions & 0 deletions release/copy.bat
@@ -0,0 +1,6 @@
COPY ..\NuGet\ServiceStack\lib\* latest\ServiceStack
COPY ..\NuGet\ServiceStack.Common\lib\* latest\ServiceStack

COPY ..\..\ServiceStack.Text\NuGet\lib\* latest\ServiceStack
COPY ..\..\ServiceStack.Redis\NuGet\lib\* latest\ServiceStack
COPY ..\..\ServiceStack.OrmLite\NuGet\ServiceStack.OrmLite.SqlServer\lib\* latest\ServiceStack
10 changes: 7 additions & 3 deletions src/ServiceStack.Common/ServiceClient.Web/ServiceClientBase.cs
Expand Up @@ -173,11 +173,15 @@ private bool HandleResponseException<TResponse>(Exception ex, string httpMethod,
var client = SendRequest(httpMethod, requestUri, request);
client.AddBasicAuth(this.UserName, this.Password);

using (var responseStream = client.GetResponse().GetResponseStream())
try
{
response = DeserializeFromStream<TResponse>(responseStream);
return true;
using (var responseStream = client.GetResponse().GetResponseStream())
{
response = DeserializeFromStream<TResponse>(responseStream);
return true;
}
}
catch { /* Ignore deserializing error exceptions */ }
}
}
catch (Exception subEx)
Expand Down
5 changes: 5 additions & 0 deletions src/ServiceStack.Common/Web/HttpResponseStreamWrapper.cs
Expand Up @@ -54,6 +54,11 @@ public void Close()
IsClosed = true;
}

public void End()
{
Close();
}

public void Flush()
{
OutputStream.Flush();
Expand Down
6 changes: 6 additions & 0 deletions src/ServiceStack.Interfaces/ServiceHost/IHttpResponse.cs
Expand Up @@ -33,6 +33,12 @@ public interface IHttpResponse
/// When used in a request or response filter, no more filters or processing is done on this request.
/// </summary>
void Close();

/// <summary>
/// Calls Response.End() on ASP.NET HttpResponse otherwise is an alias for Close().
/// Useful when you want to prevent ASP.NET to provide it's own custom error page.
/// </summary>
void End();

/// <summary>
/// Response.Flush() and OutputStream.Flush() seem to have different behaviour in ASP.NET
Expand Down
75 changes: 75 additions & 0 deletions src/ServiceStack.ServiceInterface/Auth/AssignRolesService.cs
@@ -0,0 +1,75 @@
using System.Collections.Generic;
using System.Linq;
using ServiceStack.Common;
using ServiceStack.Common.Web;
using ServiceStack.ServiceInterface.ServiceModel;

namespace ServiceStack.ServiceInterface.Auth
{
public class AssignRoles
{
public AssignRoles()
{
this.Roles = new List<string>();
this.Permissions = new List<string>();
}

public string UserName { get; set; }

public List<string> Permissions { get; set; }

public List<string> Roles { get; set; }
}

public class AssignRolesResponse : IHasResponseStatus
{
public AssignRolesResponse()
{
this.AllRoles = new List<string>();
this.AllPermissions = new List<string>();
}

public List<string> AllRoles { get; set; }

public List<string> AllPermissions { get; set; }

public ResponseStatus ResponseStatus { get; set; }
}

[RequiredRole(AuthFeature.AdminRole)]
public class AssignRolesService : RestServiceBase<AssignRoles>
{
public IUserAuthRepository UserAuthRepo { get; set; }

public override object OnPost(AssignRoles request)
{
request.UserName.ThrowIfNullOrEmpty();

var userAuth = UserAuthRepo.GetUserAuthByUserName(request.UserName);
if (userAuth == null)
throw HttpError.NotFound(request.UserName);

if (!request.Roles.IsEmpty())
{
foreach (var missingRole in request.Roles.Where(x => !userAuth.Roles.Contains(x)))
{
userAuth.Roles.Add(missingRole);
}
}
if (!request.Permissions.IsEmpty())
{
foreach (var missingPermission in request.Permissions.Where(x => !userAuth.Permissions.Contains(x)))
{
userAuth.Permissions.Add(missingPermission);
}
}

UserAuthRepo.SaveUserAuth(userAuth);

return new AssignRolesResponse {
AllRoles = userAuth.Roles,
AllPermissions = userAuth.Permissions,
};
}
}
}

0 comments on commit 5a071c8

Please sign in to comment.