コード例 #1
0
        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);
        }
コード例 #2
0
        private static bool _CheckRightWithNoErrorMessage(EUserRights requestedRight)
        {
            Guid sessionKey = _GetSession();

            if (sessionKey == Guid.Empty)
            {
                return(false);
            }

            if (!CSessionControl.RequestRight(sessionKey, requestedRight))
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
 internal static bool RequestRight(Guid sessionId, EUserRights requestedRight)
 {
     return((CUserRoleControl.GetUserRightsFromUserRole(_ActiveSessions[sessionId].Roles)
             .HasFlag(requestedRight)));
 }