unity3d 虚拟现实的操作权限设计 在进行unity3d 虚拟现实相关操作的时候基础设置是非常关键的。比如说unity3d 虚拟现实的操作权限设计就是一个重要的内容。现在我们要来学习的就是unity3d虚拟现实的操作权限的设计内容。具体知识内容如下:

returnRedirectToRoute(new { controller ="Home", action ="Index"});

47 }

48

49 privatevoid initMockData()

50 {

51 var mock =new Mock<IUserRepository<SysUser>>();

52 54 var roleList=new List<UserRole>()

55 {

56 new UserRole()

57 {

58 Id=1,

59 RoleName="Register",

60 },62 // new UserRole()

63 //{

64 // Id=2,

65 // RoleName="Admin",

66 //}

67 };

68

69 mock.Setup(m => m.findByUserID("HuntSoul"))

70 .Returns

71 (

72 new SysUser()

73 {

74 Id =1,

75 UserID ="HuntSoul",

76 UserPwd ="654321",

77 NickName ="BackDoor", //UI Modual,用于ACTION参数验证用的。

78 Roles = roleList

79 }

80 );

81

82 _Repository = mock.Object;

83 }

84 }1 using System;

2 using System.Collections.Generic;

3 using System.Linq;

4 using System.Web;

5 using System.Web.Mvc;

6 using WebUI.ActionFilter;

7

8 namespace WebUI.Controllers

9 {

10 [HandleError]

11 publicclass HomeController : Controller

12 {14 [UserAuthorize

15 (

16 Roles =newstring[]{ "Admin"},

17 UserID=newstring[]{"Admin"}

18 )

19 ]

20 public ActionResult Index()

21 {

22 ViewData["Message"] ="IndexAction

23

24 return View();

25 }

26

27 //Action级别下参数过滤

28 [FilterByUserInfo

29 (

30 Roles=newstring[]{"Admin"}

31 )

32 ]

33 public ActionResult Manage(string Modual)

34 {

35 ViewData["Message"]

1 using System;

2 using System.Collections.Generic;

3 using System.Linq;

4 using System.Web;

5 using System.Web.Mvc;

6 using Domain;

7

8 namespace WebUI.ActionFilter

9 {

10 publicclassUserAuthorizeAttribute:ActionFilterAttribute

11 {

12 ///<summary>4 ///</summary>

15 publicstring[] Roles { get; set; }

16

17 ///<summary>

19///</summary>

20 publicstring[] UserID { get; set; }

21

22 protected SysUser _User { get; set; }

23

24 publicoverridevoidOnActionExecuting(ActionExe

cutingContextfilterContext)

25 {

26 _User =HttpContext.Current.Session["User"] as SysUser;

27

28 var rolesResult = from a in _User.Roles

29 from b in Roles

30 where a.RoleName.Equals(b)

31 select a;

32

33 var userIDResult = from a in _User.UserID

34 from b in UserID

35 where a.Equals(b)

36 select a;

37

38 if (rolesResult.ToList().Count ==0&&userIDResult.ToList().Count ==0)

39 {

40 HttpContext.Current.Response.Write

41HttpContext.Current.Response.End();

42 }

43 }

44

45 publicoverridevoidOnResultExecuted(ResultExecutedContext filterContext)

46 {

47 base.OnResultExecuted(filterContext);

48 }

1 using System;

2 using System.Collections.Generic;

3 using System.Linq;

4 using System.Web;

5

6 namespace WebUI.ActionFilter

7 {

8 publicclassFilterByUserInfoAttribute:UserAuthorizeAttribute

9 {

10 publicoverridevoidOnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)

11 {

12 base.OnActionExecuting(filterContext);

13

15 var moduel =filterContext.RouteData.Values["id"].ToString();

16

17 if (_User.NickName != moduel)

18 {

19 HttpContext.Current.Response.Write

20HttpContext.Current.Response.End();

21 }

22 }

23

24 publicoverridevoidOnActionExecuted(System.Web.Mvc.ActionExecutedContext filterContext)

25 {

26 base.OnActionExecuted(filterContext);

27 }

28 }

unity3d 虚拟现实的操作权限设计具体的操作流程以及基本的注意事项主要内容就是这些了。大家在学习过程中如果还遇到疑惑可以直接查看unity3d 虚拟现实相关资料,从而进行学习和了解。