Updated the claims so we can support more users.

Added a user management section (not yet complete)
Added the api to the solution and a api key in the settings (currently only gets the requests).
This commit is contained in:
TidusJar 2016-05-15 21:51:20 -04:00
parent 741a4ae75c
commit 98eadc9cc6
12 changed files with 217 additions and 1 deletions

View file

@ -172,6 +172,8 @@ namespace PlexRequests.UI.Modules
Get["/headphones"] = _ => Headphones();
Post["/headphones"] = _ => SaveHeadphones();
Post ["/createapikey"] = x => CreateApiKey ();
}
private Negotiator Authentication()
@ -705,5 +707,20 @@ namespace PlexRequests.UI.Modules
? new JsonResponseModel { Result = true, Message = "Successfully Updated the Settings for Headphones!" }
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
}
private Response CreateApiKey()
{
this.RequiresClaims (UserClaims.Admin);
var apiKey = Guid.NewGuid ().ToString ("N");
var settings = PrService.GetSettings ();
settings.ApiKey = apiKey;
PrService.SaveSettings (settings);
return Response.AsJson (apiKey);
}
}
}