コード例 #1
0
 public static bool IsSystem(AVDUserIdentity userIdentity)
 {
     return Roles.IsUserInRole(RoleTypes.System.ToString());
 }
コード例 #2
0
 public static bool IsAdminOrSuperUser(AVDUserIdentity userIdentity)
 {
     return (Roles.IsUserInRole(RoleTypes.Administrator.ToString()) || Roles.IsUserInRole(RoleTypes.SuperUser.ToString()));
 }
コード例 #3
0
 public static bool IsRm(AVDUserIdentity userIdentity)
 {
     return userIdentity.AgencyId != null && Roles.IsUserInRole(RoleTypes.SuperAgent.ToString());
 }
コード例 #4
0
 public static bool IsManager(AVDUserIdentity userIdentity)
 {
     return userIdentity.IsManager != null && (userIdentity.AgentId != null && userIdentity.IsManager.Value &&
                                               !Roles.IsUserInRole(RoleTypes.SuperAgent.ToString()));
 }
コード例 #5
0
 public static bool IsEmployee(AVDUserIdentity userIdentity)
 {
     return userIdentity.IsEmployee != null && (userIdentity.AgentId != null && userIdentity.IsEmployee.Value && !IsManager(userIdentity) && !IsRm(userIdentity));
 }
コード例 #6
0
ファイル: AuthManager.cs プロジェクト: viniston/AV
        private static AVDIdentityBase GetAVDIdentity(String userName, bool isAuthenticated, String authenticationType)
        {
            Logger.Instance.LogFunctionEntry(typeof(AuthManager).Name, "GetAVDIdentity");

            AVDIdentityBase teIdentity;

            // Else it's a user that we store in our user tables. This will be either an Agent or Non-Agent.
            var membershipUser = Membership.GetUser(userName);

            if (membershipUser == null)
                throw new ApplicationException("User can not be found '" + userName);

            var userDto = membershipUser as UserDto;

            if (userDto == null)
                throw new ApplicationException("Can cast the MembershipUser into " + typeof (UserDto).Name);

            if (userDto.UserId <= 0)
                throw new ApplicationException("Invalid userDto - " + userDto);
          
            // Non-Agent User
            teIdentity = new AVDUserIdentity(userName, isAuthenticated, authenticationType, userDto.FirstName, userDto.LastName, userDto.Email, userDto.UserId,
                null, null, null, null, null);
            
            Logger.Instance.LogFunctionExit(typeof(AuthManager).Name, "GetAVDIdentity");

            return teIdentity;
        }