Ejemplo n.º 1
0
        private SessionInfo GetSession()
        {
            var auth = AuthorizationRequestFilterAttribute.GetAuthorization(RequestContext);

            return(_sessionManager.Sessions.First(i => string.Equals(i.DeviceId, auth.DeviceId) &&
                                                  string.Equals(i.Client, auth.Client) &&
                                                  string.Equals(i.ApplicationVersion, auth.Version)));
        }
Ejemplo n.º 2
0
        private void AssertUserCanManageLiveTv()
        {
            var user = AuthorizationRequestFilterAttribute.GetCurrentUser(Request, _userManager);

            if (user == null)
            {
                throw new UnauthorizedAccessException("Anonymous live tv management is not allowed.");
            }

            if (!user.Configuration.EnableLiveTvManagement)
            {
                throw new UnauthorizedAccessException("The current user does not have permission to manage live tv.");
            }
        }