mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-31 12:00:06 -07:00
fix(user-management): 🐛 Fixed an issue where the Copy users App Link did not generate the correct app link for that user
This commit is contained in:
parent
2fe41f3910
commit
8cafcdcc3b
4 changed files with 31 additions and 2 deletions
3
src/Ombi/.vscode/settings.json
vendored
3
src/Ombi/.vscode/settings.json
vendored
|
@ -15,6 +15,7 @@
|
||||||
"discover",
|
"discover",
|
||||||
"request-limits",
|
"request-limits",
|
||||||
"notifications",
|
"notifications",
|
||||||
"settings"
|
"settings",
|
||||||
|
"user-management"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ export class IdentityService extends ServiceHelpers {
|
||||||
return this.http.get<string>(`${this.url}accesstoken`, {headers: this.headers});
|
return this.http.get<string>(`${this.url}accesstoken`, {headers: this.headers});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getUserAccessToken(userId: string): Observable<string> {
|
||||||
|
return this.http.get<string>(`${this.url}accesstoken/${userId}`, {headers: this.headers});
|
||||||
|
}
|
||||||
|
|
||||||
public getUserById(id: string): Observable<IUser> {
|
public getUserById(id: string): Observable<IUser> {
|
||||||
return this.http.get<IUser>(`${this.url}User/${id}`, {headers: this.headers});
|
return this.http.get<IUser>(`${this.url}User/${id}`, {headers: this.headers});
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ export class UserManagementUserComponent implements OnInit {
|
||||||
this.radarrService.getRootFoldersFromSettings().subscribe(x => this.radarrRootFolders = x);
|
this.radarrService.getRootFoldersFromSettings().subscribe(x => this.radarrRootFolders = x);
|
||||||
|
|
||||||
this.settingsService.getCustomization().subscribe(x => this.customization = x);
|
this.settingsService.getCustomization().subscribe(x => this.customization = x);
|
||||||
this.identityService.getAccessToken().subscribe(x => this.accessToken = x);
|
this.identityService.getUserAccessToken(this.userId).subscribe(x => this.accessToken = x);
|
||||||
|
|
||||||
if(!this.edit) {
|
if(!this.edit) {
|
||||||
this.user = {
|
this.user = {
|
||||||
|
|
|
@ -947,6 +947,30 @@ namespace Ombi.Controllers.V1
|
||||||
return user.UserAccessToken;
|
return user.UserAccessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("accesstoken/{userId}")]
|
||||||
|
[PowerUser]
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public async Task<string> GetUserAccessToken(string userId)
|
||||||
|
{
|
||||||
|
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.Id == userId);
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
return Guid.Empty.ToString("N");
|
||||||
|
}
|
||||||
|
if (user.UserAccessToken.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
// Let's create an access token for this user
|
||||||
|
user.UserAccessToken = Guid.NewGuid().ToString("N");
|
||||||
|
var result = await UserManager.UpdateAsync(user);
|
||||||
|
if (!result.Succeeded)
|
||||||
|
{
|
||||||
|
LogErrors(result);
|
||||||
|
return Guid.Empty.ToString("N");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return user.UserAccessToken;
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("notificationpreferences")]
|
[HttpGet("notificationpreferences")]
|
||||||
public async Task<List<UserNotificationPreferences>> GetUserPreferences()
|
public async Task<List<UserNotificationPreferences>> GetUserPreferences()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue