Subsonic API code complete for features used by Roadie.

This commit is contained in:
Steven Hildreth 2018-11-25 21:15:19 -06:00
parent f6d94677d4
commit 30b5bf0beb
3 changed files with 25 additions and 16 deletions

View file

@ -2337,21 +2337,21 @@ namespace Roadie.Api.Services
var isEditor = await this.UserManger.IsInRoleAsync(user, "Editor"); var isEditor = await this.UserManger.IsInRoleAsync(user, "Editor");
return new subsonic.User return new subsonic.User
{ {
adminRole = isAdmin, adminRole = false, // disabling this as we dont want Roadie user management done via Subsonic API
avatarLastChanged = user.LastUpdated ?? user.CreatedDate ?? DateTime.UtcNow, avatarLastChanged = user.LastUpdated ?? user.CreatedDate ?? DateTime.UtcNow,
avatarLastChangedSpecified = user.LastUpdated.HasValue, avatarLastChangedSpecified = user.LastUpdated.HasValue,
commentRole = true, commentRole = true,
coverArtRole = isEditor || isAdmin, coverArtRole = isEditor || isAdmin,
downloadRole = isEditor || isAdmin, // Disable downloads downloadRole = isEditor || isAdmin,
email = user.Email, email = user.Email,
jukeboxRole = true, jukeboxRole = false, // Jukebox disabled (what is jukebox?)
maxBitRate = 320, maxBitRate = 320,
maxBitRateSpecified = true, maxBitRateSpecified = true,
playlistRole = isEditor || isAdmin, playlistRole = isEditor || isAdmin,
podcastRole = false, // Disable podcast nonsense podcastRole = false, // Disable podcast nonsense
scrobblingEnabled = false, // Disable scrobbling scrobblingEnabled = false, // Disable scrobbling
settingsRole = isAdmin, settingsRole = isAdmin,
shareRole = false, // TODO enabled when sharing is implemented shareRole = false,
streamRole = true, streamRole = true,
uploadRole = true, uploadRole = true,
username = user.UserName, username = user.UserName,

View file

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Roadie.Library.Data; using Roadie.Library.Data;
using Roadie.Library.Enums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -103,10 +104,8 @@ namespace Roadie.Library.Identity
[StringLength(36)] [StringLength(36)]
public Guid RoadieId { get; set; } public Guid RoadieId { get; set; }
// public virtual ICollection<UsersInRoles> Roles { get; set; }
[Column("status")] [Column("status")]
public short? Status { get; set; } public Statuses? Status { get; set; }
public ICollection<Submission> Submissions { get; set; } public ICollection<Submission> Submissions { get; set; }
@ -120,15 +119,8 @@ namespace Roadie.Library.Identity
public ICollection<UserTrack> TrackRatings { get; set; } public ICollection<UserTrack> TrackRatings { get; set; }
//[Column("username")]
//[Required]
//[StringLength(20)]
//public string UserName { get; set; }
public virtual ICollection<ApplicationUserRole> UserRoles { get; set; }
public virtual ICollection<UserQue> UserQues { get; set; } public virtual ICollection<UserQue> UserQues { get; set; }
public virtual ICollection<ApplicationUserRole> UserRoles { get; set; }
} }
} }

View file

@ -1,4 +1,5 @@
using System; using Roadie.Library.Enums;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -49,5 +50,21 @@ namespace Roadie.Library.Identity
{ {
return $"Id [{ this.Id }], Username [{ this.UserName}]"; return $"Id [{ this.Id }], Username [{ this.UserName}]";
} }
public ApplicationUser()
{
this.RoadieId = Guid.NewGuid();
this.Status = Statuses.Ok;
this.CreatedDate = DateTime.UtcNow;
this.IsLocked = false;
this.IsActive = true;
this.DoUseHtmlPlayer = true;
this.PlayerTrackLimit = 50;
this.Timeformat = "YYYY-MM-DD HH:mm:ss";
this.IsPrivate = false;
this.RecentlyPlayedLimit = 20;
this.RandomReleaseLimit = 20;
}
} }
} }