Me.User.HasPermissions brings FALSE on any permission
-
Wednesday, April 11, 2012 1:40 PMHi!
I created my first app in LS, and now trying to add permissions to my screens.
I have two domain users, the one I logged in I suppose to be Admin.
I created permissions in App.Properties, created roles, added permissions to roles and added roles to users.
Now in <form>Name>_CanRun I want to allow open this screen only to Admin.
So I added clause as seen in many examples
result = Me.User.Haspermission(Permissions.Admin)
or
result = Me.User.IsInRole("Admin")
(Admin is a role and permission, I've tried another permissions and roles as well). In edit/debug mode I can see intellisense prompt of my permissions and roles,
but clause returns FALSE only. So I cant see my screen on menu.
Some ideas?
Big thanx
All Replies
-
Wednesday, April 11, 2012 9:40 PMModerator
If you are trying to test your permission code during debugging (F5) and not in a real published application, you need to set "Granted for debug" to any permissions you want to grant to the "test user" that you are running as.
See this MSDN Magazine article for more information on developing with the LightSwitch Security system. http://msdn.microsoft.com/en-us/magazine/hh456409.aspx
- Proposed As Answer by Eric ErhardtMicrosoft Employee, Moderator Wednesday, April 11, 2012 9:40 PM
- Marked As Answer by Allen Li - MSFTModerator Tuesday, April 17, 2012 1:29 AM

