Webserver: Fixed a userrights bug
This commit is contained in:
1 parent
4c932ba85c
commit
e68dafd16e
4 files changed
+22
-22
No files matched your search
@@ -48,12 +48,12 @@ namespace ServerLib
|
|||||||
{
|
{
|
||||||
_ActiveSessions.Remove(s.Key);
|
_ActiveSessions.Remove(s.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool RequestRight(Guid sessionId, EUserRights requestedRight)
|
internal static bool RequestRight(Guid sessionId, EUserRights requestedRight)
|
||||||
{
|
{
|
||||||
return ((CUserRoleControl.GetUserRightsFromUserRole(_ActiveSessions[sessionId].Roles) & requestedRight) != 0);
|
return ((CUserRoleControl.GetUserRightsFromUserRole(_ActiveSessions[sessionId].Roles)
|
||||||
|
.HasFlag(requestedRight)));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static int GetUserIdFromSession(Guid sessionId)
|
internal static int GetUserIdFromSession(Guid sessionId)
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ namespace ServerLib
|
|||||||
[Flags]
|
[Flags]
|
||||||
internal enum EUserRights
|
internal enum EUserRights
|
||||||
{
|
{
|
||||||
None = 0x00,
|
None = 0,
|
||||||
EditAllProfiles = 0x01,
|
EditAllProfiles = 1,
|
||||||
UploadPhotos = 0x02,
|
UploadPhotos = 2,
|
||||||
ViewOtherProfiles = 0x04,
|
ViewOtherProfiles = 4,
|
||||||
UseKeyboard = 0x08,
|
UseKeyboard = 8,
|
||||||
ReorderPlaylists = 0x16,
|
ReorderPlaylists = 16,
|
||||||
AddSongToPlaylist = 0x32,
|
AddSongToPlaylist = 32,
|
||||||
CreatePlaylists = 0x64,
|
CreatePlaylists = 64,
|
||||||
DeletePlaylists = 0x128,
|
DeletePlaylists = 128,
|
||||||
RemoveSongsFromPlaylists = 0x256
|
RemoveSongsFromPlaylists = 256
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ namespace ServerLib
|
|||||||
[Flags]
|
[Flags]
|
||||||
internal enum EUserRoles
|
internal enum EUserRoles
|
||||||
{
|
{
|
||||||
AuthenticatedUser = 0x00,
|
AuthenticatedUser = 0,
|
||||||
Administrator = 0x01
|
Administrator = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ function initPageLoadHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x32
|
url: "hasUserRight?right=" + 32
|
||||||
}).done(function (result2) {
|
}).done(function (result2) {
|
||||||
if (result2) {
|
if (result2) {
|
||||||
$('#displaySongAddPlaylist').show();
|
$('#displaySongAddPlaylist').show();
|
||||||
@@ -375,7 +375,7 @@ function initPageLoadHandler() {
|
|||||||
//pageLoadHandler for main
|
//pageLoadHandler for main
|
||||||
$(document).on('pagebeforeshow', '#main', function () {
|
$(document).on('pagebeforeshow', '#main', function () {
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x02
|
url: "hasUserRight?right=" + 2
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#mainPageTakePhotoLink').parent().parent().parent().show();
|
$('#mainPageTakePhotoLink').parent().parent().parent().show();
|
||||||
@@ -385,7 +385,7 @@ function initPageLoadHandler() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x08
|
url: "hasUserRight?right=" + 8
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#mainPageKeyboard').parent().parent().parent().show();
|
$('#mainPageKeyboard').parent().parent().parent().show();
|
||||||
@@ -395,7 +395,7 @@ function initPageLoadHandler() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x04
|
url: "hasUserRight?right=" + 4
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#mainPageSelectProfile').parent().parent().parent().show();
|
$('#mainPageSelectProfile').parent().parent().parent().show();
|
||||||
@@ -452,7 +452,7 @@ function initPageLoadHandler() {
|
|||||||
$('#selectPlaylistContentList').listview('refresh');
|
$('#selectPlaylistContentList').listview('refresh');
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x128
|
url: "hasUserRight?right=" + 128
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#selectPlaylistContentList').find('.delete').show();
|
$('#selectPlaylistContentList').find('.delete').show();
|
||||||
@@ -481,7 +481,7 @@ function initPageLoadHandler() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x64
|
url: "hasUserRight?right=" + 64
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#selectPlaylistAddPlaylistButton').show();
|
$('#selectPlaylistAddPlaylistButton').show();
|
||||||
@@ -587,7 +587,7 @@ function initPageLoadHandler() {
|
|||||||
$('#displayPlaylistContentList').listview('refresh');
|
$('#displayPlaylistContentList').listview('refresh');
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x256
|
url: "hasUserRight?right=" + 256
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#displayPlaylistContentList').find('.delete').show();
|
$('#displayPlaylistContentList').find('.delete').show();
|
||||||
@@ -599,7 +599,7 @@ function initPageLoadHandler() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: "hasUserRight?right=" + 0x16
|
url: "hasUserRight?right=" + 16
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#displayPlaylistContentList').sortable({
|
$('#displayPlaylistContentList').sortable({
|
||||||
|
|||||||
Reference in new issue
Block a user