コード例 #1
0
ファイル: UserRole.cs プロジェクト: Kledal/semesterprojekt4
        private bool HasAccessTo(UserRoleMethod method)
        {
            var returnBool = false;

            switch (method)
            {
            case UserRoleMethod.CanCreateBooking:
                returnBool = CanCreateBooking;
                break;

            case UserRoleMethod.CanViewDashboard:
                returnBool = CanViewDashboard;
                break;
            }
            return(returnBool);
        }
コード例 #2
0
ファイル: UserRole.cs プロジェクト: Kledal/semesterprojekt4
 public static bool Can(User u, UserRoleMethod method)
 {
     return(u != null && u.UserRole.HasAccessTo(method));
 }
コード例 #3
0
        public static bool Can(this ViewContext view, UserRoleMethod method)
        {
            var user = CurrentUser(view);

            return(UserRole.Can(user, method));
        }