コード例 #1
0
 /// <summary>
 /// Make a database call to check if the user has access to the passed in function
 /// </summary>
 /// <param name="functionId"></param>
 /// <returns></returns>
 public bool HasFunctionId(int functionId)
 {
     try
     {
         //check user for functionid using userId
         var security = new SecurityModel();
         var userId = ((NeonUserIdentity)Identity).UserId;
         return userId != null && security.UserHasFunction(userId.Value, functionId);
     }
     catch(Exception ex)
     {
         throw new Exception("functionId;"+functionId,ex);
     }
 }
コード例 #2
0
        /// <summary>
        /// Login the user to the system by checking that they are a named user in the system; 
        /// Authentication is accomplished via AD
        /// </summary>
        /// <returns></returns>
        public bool Login()
        {
            //if the user is already authenticated continue
            if (IsAuthenticated)
            {
                return true;
            }

            try
            {
                //check that the logged in user is an authenticated user in the system
                var security = new SecurityModel();
                UserId = security.Login(Name);
                return IsAuthenticated;
            }
            catch (Exception ex)
            {
                // ReSharper disable once PossibleIntendedRethrow
                throw ex;
            }
        }