Ejemplo n.º 1
0
 /// <summary>
 /// Throw WebFaultException with error code 403 forbidden if
 /// session id and token are not valid.
 /// </summary>
 /// <param name="sessionManager"></param>
 /// <param name="sid"></param>
 /// <param name="token"></param>
 public static void Session(SessionManager sessionManager, int sid, string token)
 {
     int userid;
     string site;
     if (!sessionManager.ValidateSession(sid, token, out userid, out site))
         throw new WebFaultException(System.Net.HttpStatusCode.Forbidden);
 }
Ejemplo n.º 2
0
        public RestaurantService()
        {
            //String connection = "Data Source =WINTOP; Initial Catalog =core; User Id =sa; Password =admin;";
            String connection = "Data Source =mw87ap2qqg.database.windows.net; Initial Catalog =BiteNet; User Id =BiteNetUser; Password =1q2w3e!@#;";
            dc = new BiteNet.LinqToSql.CoreDataContext(connection);

            sessionManager = new SessionManager(dc);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Throw WebFaultException with error code 403 forbidden if
 /// session id and token are not valid for the user specified by userId
 /// and if the 
 /// </summary>
 /// <param name="sessionManager"></param>
 /// <param name="sid"></param>
 /// <param name="token"></param>
 /// <param name="userId"></param>
 /// <param name="allowManageOverride"></param>
 public static void Session(SessionManager sessionManager, int sid, string token, int userId, bool allowManageOverride)
 {
     if (!sessionManager.ValidateSession(userId, token, sid) &&
         (!allowManageOverride || !sessionManager.ValidateSession(SessionManager.MANAGE_ID, token, sid)))
             throw new WebFaultException(System.Net.HttpStatusCode.Forbidden);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Throw WebFaultException with error code 403 forbidden if
 /// session id and token are not valid for the user specified by userId.
 /// </summary>
 /// <param name="sessionManager"></param>
 /// <param name="sid"></param>
 /// <param name="token"></param>
 /// <param name="userId"></param>
 public static void Session(SessionManager sessionManager, int sid, string token, int userId)
 {
     Guard.Session(sessionManager, sid, token, userId, false);
 }