Edit UserRoles over the webserver
This commit is contained in:
1 parent
652fdabc3e
commit
08f4428e28
3 files changed
+136
-4
No files matched your search
@@ -119,6 +119,22 @@ namespace ServerLib
|
||||
SongInfo[] getAllSongs();
|
||||
|
||||
#endregion
|
||||
|
||||
#region user management
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/getUserRole?profileId={profileId}")]
|
||||
int getUserRole(int profileId);
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/setUserRole?profileId={profileId}&userRole={userRole}")]
|
||||
void setUserRole(int profileId, int userRole);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
class CWebservice : ICWebservice
|
||||
@@ -386,5 +402,25 @@ namespace ServerLib
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region user management
|
||||
|
||||
public int getUserRole(int profileId)
|
||||
{
|
||||
return CServer.GetUserRole(profileId);
|
||||
}
|
||||
|
||||
public void setUserRole(int profileId, int userRole)
|
||||
{
|
||||
Guid sessionKey = getSession();
|
||||
if (!SessionControl.requestRight(sessionKey, UserRights.EditAllProfiles))
|
||||
{
|
||||
WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Forbidden;
|
||||
return;
|
||||
}
|
||||
CServer.SetUserRole(profileId, userRole);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user