Webserver:
- Create/edit/delete playlists in the app - Fixed projektconfiguration (some project builds were disabled) - hide menue lines if the user has no right
This commit is contained in:
1 parent
959a11a4a2
commit
35657f8698
19 files changed
+572
-113
No files matched your search
@@ -84,14 +84,14 @@ namespace ServerLib
|
||||
private static GetAllSongsDelegate _GetAllSongs;
|
||||
public static GetAllSongsDelegate GetAllSongs
|
||||
{
|
||||
get { return CServer._GetAllSongs; }
|
||||
internal get { return CServer._GetAllSongs; }
|
||||
set { CServer._GetAllSongs = value; }
|
||||
}
|
||||
|
||||
private static GetCurrentSongIdDelegate _GetCurrentSongId;
|
||||
public static GetCurrentSongIdDelegate GetCurrentSongId
|
||||
{
|
||||
get { return CServer._GetCurrentSongId; }
|
||||
internal get { return CServer._GetCurrentSongId; }
|
||||
set { CServer._GetCurrentSongId = value; }
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace ServerLib
|
||||
private static GetPlaylistsDelegate _GetPlaylists;
|
||||
public static GetPlaylistsDelegate GetPlaylists
|
||||
{
|
||||
get { return _GetPlaylists; }
|
||||
internal get { return _GetPlaylists; }
|
||||
set { _GetPlaylists = value; }
|
||||
}
|
||||
|
||||
@@ -111,45 +111,59 @@ namespace ServerLib
|
||||
private static GetPlaylistDelegate _GetPlaylist;
|
||||
public static GetPlaylistDelegate GetPlaylist
|
||||
{
|
||||
get { return _GetPlaylist; }
|
||||
internal get { return _GetPlaylist; }
|
||||
set { _GetPlaylist = value; }
|
||||
}
|
||||
|
||||
private static AddSongToPlaylistDelegate _AddSongToPlaylist;
|
||||
public static AddSongToPlaylistDelegate AddSongToPlaylist
|
||||
{
|
||||
get { return _AddSongToPlaylist; }
|
||||
internal get { return _AddSongToPlaylist; }
|
||||
set { _AddSongToPlaylist = value; }
|
||||
}
|
||||
|
||||
private static RemoveSongFromPlaylistDelegate _RemoveSongFromPlaylist;
|
||||
public static RemoveSongFromPlaylistDelegate RemoveSongFromPlaylist
|
||||
{
|
||||
get { return _RemoveSongFromPlaylist; }
|
||||
internal get { return _RemoveSongFromPlaylist; }
|
||||
set { _RemoveSongFromPlaylist = value; }
|
||||
}
|
||||
|
||||
private static MoveSongInPlaylistDelegate _MoveSongInPlaylist;
|
||||
public static MoveSongInPlaylistDelegate MoveSongInPlaylist
|
||||
{
|
||||
get { return _MoveSongInPlaylist; }
|
||||
internal get { return _MoveSongInPlaylist; }
|
||||
set { _MoveSongInPlaylist = value; }
|
||||
}
|
||||
|
||||
private static PlaylistContainsSongDelegate _PlaylistContainsSong;
|
||||
public static PlaylistContainsSongDelegate PlaylistContainsSong
|
||||
{
|
||||
get { return _PlaylistContainsSong; }
|
||||
internal get { return _PlaylistContainsSong; }
|
||||
set { _PlaylistContainsSong = value; }
|
||||
}
|
||||
|
||||
private static GetPlaylistSongsDelegate _GetPlaylistSongs;
|
||||
public static GetPlaylistSongsDelegate GetPlaylistSongs
|
||||
{
|
||||
get { return _GetPlaylistSongs; }
|
||||
internal get { return _GetPlaylistSongs; }
|
||||
set { _GetPlaylistSongs = value; }
|
||||
}
|
||||
|
||||
private static RemovePlaylistDelegate _RemovePlaylist;
|
||||
public static RemovePlaylistDelegate RemovePlaylist
|
||||
{
|
||||
internal get { return _RemovePlaylist; }
|
||||
set { _RemovePlaylist = value; }
|
||||
}
|
||||
|
||||
private static AddPlaylistDelegate _AddPlaylist;
|
||||
public static AddPlaylistDelegate AddPlaylist
|
||||
{
|
||||
internal get { return _AddPlaylist; }
|
||||
set { _AddPlaylist = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region user management
|
||||
@@ -188,9 +202,9 @@ namespace ServerLib
|
||||
internal get { return CServer._GetUserIdFromUsername; }
|
||||
set { CServer._GetUserIdFromUsername = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public CServer(int port, bool encrypted)
|
||||
{
|
||||
_Init(port, encrypted);
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace ServerLib
|
||||
|
||||
public void AddSongToPlaylist(int songId, int playlistId, bool allowDuplicates)
|
||||
{
|
||||
if (_CheckRight(EUserRights.AddSongToPlaylist) || _CheckRight(EUserRights.EditPlaylists))
|
||||
if (_CheckRight(EUserRights.AddSongToPlaylist))
|
||||
{
|
||||
CServer.AddSongToPlaylist(songId, playlistId, allowDuplicates);
|
||||
}
|
||||
@@ -309,17 +309,17 @@ namespace ServerLib
|
||||
|
||||
public void RemoveSongFromPlaylist(int position, int playlistId, int songId)
|
||||
{
|
||||
if (_CheckRight(EUserRights.EditPlaylists))
|
||||
if (_CheckRight(EUserRights.RemoveSongsFromPlaylists))
|
||||
{
|
||||
CServer.RemoveSongFromPlaylist(position, playlistId, songId);
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveSongInPlaylist(int oldPosition, int newPosition, int playlistId, int songId)
|
||||
public void MoveSongInPlaylist(int newPosition, int playlistId, int songId)
|
||||
{
|
||||
if (_CheckRight(EUserRights.EditPlaylists))
|
||||
if (_CheckRight(EUserRights.ReorderPlaylists))
|
||||
{
|
||||
CServer.MoveSongInPlaylist(oldPosition, newPosition, playlistId, songId);
|
||||
CServer.MoveSongInPlaylist(newPosition, playlistId, songId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,9 +333,21 @@ namespace ServerLib
|
||||
return CServer.GetPlaylistSongs(playlistId);
|
||||
}
|
||||
|
||||
public bool IsPlaylistEditable(int playlistId)
|
||||
public void RemovePlaylist(int playlistId)
|
||||
{
|
||||
return _CheckRight(EUserRights.EditPlaylists);
|
||||
if (_CheckRight(EUserRights.DeletePlaylists))
|
||||
{
|
||||
CServer.RemovePlaylist(playlistId);
|
||||
}
|
||||
}
|
||||
|
||||
public int AddPlaylist(string playlistName)
|
||||
{
|
||||
if (_CheckRight(EUserRights.CreatePlaylists))
|
||||
{
|
||||
return CServer.AddPlaylist(playlistName);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -354,6 +366,11 @@ namespace ServerLib
|
||||
CServer.SetUserRole(profileId, userRole);
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasUserRight(int right)
|
||||
{
|
||||
return _CheckRight((EUserRights)right);
|
||||
}
|
||||
|
||||
private static bool _CheckRight(EUserRights requestedRight)
|
||||
{
|
||||
@@ -382,5 +399,6 @@ namespace ServerLib
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -108,20 +108,7 @@ namespace ServerLib
|
||||
public delegate SSongInfo[] GetAllSongsDelegate();
|
||||
|
||||
public delegate int GetCurrentSongIdDelegate();
|
||||
|
||||
public delegate SPlaylistInfo[] GetPlaylistsDelegate();
|
||||
|
||||
public delegate SPlaylistInfo GetPlaylistDelegate(int playlistId);
|
||||
|
||||
public delegate void AddSongToPlaylistDelegate(int songId, int playlistId, bool allowDuplicates);
|
||||
|
||||
public delegate void RemoveSongFromPlaylistDelegate(int position, int playlistId, int songId);
|
||||
|
||||
public delegate void MoveSongInPlaylistDelegate(int oldPosition, int newPosition, int playlistId, int songId);
|
||||
|
||||
public delegate bool PlaylistContainsSongDelegate(int songId, int playlistId);
|
||||
|
||||
public delegate SPlaylistSongInfo[] GetPlaylistSongsDelegate(int playlistId);
|
||||
|
||||
|
||||
[DataContract]
|
||||
public struct SSongInfo
|
||||
@@ -144,6 +131,28 @@ namespace ServerLib
|
||||
public int SongId { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region playlists
|
||||
public delegate SPlaylistInfo[] GetPlaylistsDelegate();
|
||||
|
||||
public delegate SPlaylistInfo GetPlaylistDelegate(int playlistId);
|
||||
|
||||
public delegate void AddSongToPlaylistDelegate(int songId, int playlistId, bool allowDuplicates);
|
||||
|
||||
public delegate void RemoveSongFromPlaylistDelegate(int position, int playlistId, int songId);
|
||||
|
||||
public delegate void MoveSongInPlaylistDelegate(int newPosition, int playlistId, int songId);
|
||||
|
||||
public delegate bool PlaylistContainsSongDelegate(int songId, int playlistId);
|
||||
|
||||
public delegate SPlaylistSongInfo[] GetPlaylistSongsDelegate(int playlistId);
|
||||
|
||||
public delegate void RemovePlaylistDelegate(int playlistId);
|
||||
|
||||
public delegate int AddPlaylistDelegate(string playlistName);
|
||||
|
||||
[DataContract]
|
||||
public struct SPlaylistSongInfo
|
||||
{
|
||||
[DataMember]
|
||||
@@ -155,7 +164,8 @@ namespace ServerLib
|
||||
[DataMember]
|
||||
public int GameMode;
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
public struct SPlaylistInfo
|
||||
{
|
||||
[DataMember]
|
||||
|
||||
@@ -150,8 +150,8 @@ namespace ServerLib
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/moveSongInPlaylist?oldPosition={oldPosition}&newPosition={newPosition}&playlistId={playlistId}&songId={songId}")]
|
||||
void MoveSongInPlaylist(int oldPosition, int newPosition, int playlistId, int songId);
|
||||
UriTemplate = "/moveSongInPlaylist?newPosition={newPosition}&playlistId={playlistId}&songId={songId}")]
|
||||
void MoveSongInPlaylist(int newPosition, int playlistId, int songId);
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
@@ -166,9 +166,14 @@ namespace ServerLib
|
||||
SPlaylistSongInfo[] GetPlaylistSongs(int playlistId);
|
||||
|
||||
[OperationContract, WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/isPlaylistEditable?playlistId={playlistId}")]
|
||||
bool IsPlaylistEditable(int playlistId);
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/removePlaylist?playlistId={playlistId}")]
|
||||
void RemovePlaylist(int playlistId);
|
||||
|
||||
[OperationContract, WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/addPlaylist?playlistName={playlistName}")]
|
||||
int AddPlaylist(string playlistName);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -186,6 +191,12 @@ namespace ServerLib
|
||||
UriTemplate = "/setUserRole?profileId={profileId}&userRole={userRole}")]
|
||||
void SetUserRole(int profileId, int userRole);
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/hasUserRight?right={right}")]
|
||||
bool HasUserRight(int right);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,10 @@ namespace ServerLib
|
||||
UploadPhotos = 0x02,
|
||||
ViewOtherProfiles = 0x04,
|
||||
UseKeyboard = 0x08,
|
||||
EditPlaylists = 0x16,
|
||||
AddSongToPlaylist = 0x32
|
||||
ReorderPlaylists = 0x16,
|
||||
AddSongToPlaylist = 0x32,
|
||||
CreatePlaylists = 0x64,
|
||||
DeletePlaylists = 0x128,
|
||||
RemoveSongsFromPlaylists = 0x256
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,13 @@ namespace ServerLib
|
||||
{EUserRoles.Administrator,
|
||||
(EUserRights.EditAllProfiles|
|
||||
EUserRights.UploadPhotos|
|
||||
EUserRights.ViewOtherProfiles)|
|
||||
EUserRights.UseKeyboard},
|
||||
EUserRights.ViewOtherProfiles|
|
||||
EUserRights.UseKeyboard|
|
||||
EUserRights.AddSongToPlaylist|
|
||||
EUserRights.ReorderPlaylists|
|
||||
EUserRights.CreatePlaylists|
|
||||
EUserRights.DeletePlaylists|
|
||||
EUserRights.RemoveSongsFromPlaylists)},
|
||||
{EUserRoles.AuthenticatedUser,
|
||||
(EUserRights.UploadPhotos|
|
||||
EUserRights.ViewOtherProfiles|
|
||||
|
||||
Reference in new issue
Block a user