private static bool _CheckRight(EUserRights requestedRight) { Guid sessionKey = _GetSession(); if (sessionKey == Guid.Empty) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Forbidden; WebOperationContext.Current.OutgoingResponse.StatusDescription = "No session"; } return(false); } if (!CSessionControl.RequestRight(sessionKey, requestedRight)) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Forbidden; WebOperationContext.Current.OutgoingResponse.StatusDescription = "Not allowed"; } return(false); } return(true); }
public SProfileData GetProfile(int profileId) { Guid sessionKey = _GetSession(); if (CSessionControl.GetUserIdFromSession(sessionKey) == profileId || _CheckRight(EUserRights.ViewOtherProfiles)) { bool isReadonly = (!CSessionControl.RequestRight(sessionKey, EUserRights.EditAllProfiles) && CSessionControl.GetUserIdFromSession(sessionKey) != profileId); return(CVocaluxeServer.DoTask(CVocaluxeServer.GetProfileData, profileId, isReadonly)); } return(new SProfileData()); }
private static bool _CheckRightWithNoErrorMessage(EUserRights requestedRight) { Guid sessionKey = _GetSession(); if (sessionKey == Guid.Empty) { return(false); } if (!CSessionControl.RequestRight(sessionKey, requestedRight)) { return(false); } return(true); }