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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -5,15 +5,15 @@ namespace ServerLib
|
||||
[Flags]
|
||||
internal enum EUserRights
|
||||
{
|
||||
None = 0x00,
|
||||
EditAllProfiles = 0x01,
|
||||
UploadPhotos = 0x02,
|
||||
ViewOtherProfiles = 0x04,
|
||||
UseKeyboard = 0x08,
|
||||
ReorderPlaylists = 0x16,
|
||||
AddSongToPlaylist = 0x32,
|
||||
CreatePlaylists = 0x64,
|
||||
DeletePlaylists = 0x128,
|
||||
RemoveSongsFromPlaylists = 0x256
|
||||
None = 0,
|
||||
EditAllProfiles = 1,
|
||||
UploadPhotos = 2,
|
||||
ViewOtherProfiles = 4,
|
||||
UseKeyboard = 8,
|
||||
ReorderPlaylists = 16,
|
||||
AddSongToPlaylist = 32,
|
||||
CreatePlaylists = 64,
|
||||
DeletePlaylists = 128,
|
||||
RemoveSongsFromPlaylists = 256
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace ServerLib
|
||||
[Flags]
|
||||
internal enum EUserRoles
|
||||
{
|
||||
AuthenticatedUser = 0x00,
|
||||
Administrator = 0x01
|
||||
AuthenticatedUser = 0,
|
||||
Administrator = 1
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ function initPageLoadHandler() {
|
||||
}
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x32
|
||||
url: "hasUserRight?right=" + 32
|
||||
}).done(function (result2) {
|
||||
if (result2) {
|
||||
$('#displaySongAddPlaylist').show();
|
||||
@@ -375,7 +375,7 @@ function initPageLoadHandler() {
|
||||
//pageLoadHandler for main
|
||||
$(document).on('pagebeforeshow', '#main', function () {
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x02
|
||||
url: "hasUserRight?right=" + 2
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#mainPageTakePhotoLink').parent().parent().parent().show();
|
||||
@@ -385,7 +385,7 @@ function initPageLoadHandler() {
|
||||
});
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x08
|
||||
url: "hasUserRight?right=" + 8
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#mainPageKeyboard').parent().parent().parent().show();
|
||||
@@ -395,7 +395,7 @@ function initPageLoadHandler() {
|
||||
});
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x04
|
||||
url: "hasUserRight?right=" + 4
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#mainPageSelectProfile').parent().parent().parent().show();
|
||||
@@ -452,7 +452,7 @@ function initPageLoadHandler() {
|
||||
$('#selectPlaylistContentList').listview('refresh');
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x128
|
||||
url: "hasUserRight?right=" + 128
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#selectPlaylistContentList').find('.delete').show();
|
||||
@@ -481,7 +481,7 @@ function initPageLoadHandler() {
|
||||
});
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x64
|
||||
url: "hasUserRight?right=" + 64
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#selectPlaylistAddPlaylistButton').show();
|
||||
@@ -587,7 +587,7 @@ function initPageLoadHandler() {
|
||||
$('#displayPlaylistContentList').listview('refresh');
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x256
|
||||
url: "hasUserRight?right=" + 256
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#displayPlaylistContentList').find('.delete').show();
|
||||
@@ -599,7 +599,7 @@ function initPageLoadHandler() {
|
||||
});
|
||||
|
||||
request({
|
||||
url: "hasUserRight?right=" + 0x16
|
||||
url: "hasUserRight?right=" + 16
|
||||
}).done(function (result) {
|
||||
if (result) {
|
||||
$('#displayPlaylistContentList').sortable({
|
||||
|
||||
Reference in new issue
Block a user