Programatically access users role


Author
Message
Philipp Guntermann
Philipp Guntermann
StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Is there a simple way to access the rules assigned to a specified user ?

this is what i got so far:

ISecurityUser U = MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser;

MicroFour.StrataFrame.Security.BusinessObjects.SFSRolesBO RolesBO = new MicroFour.StrataFrame.Security.BusinessObjects.SFSRolesBO();

RolesBO.FillAllByUser(U.UserPK);

..

thanks Smile


Replies
Guillermo Vilas
Guillermo Vilas
StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)StrataFrame User (294 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 2.3K
I just wanted to share what I did to accomplish this.



I have a button that launchs the Inventory Transaction Number Dialog, I want this Dialog to show only to the Warehouse Manager Role:







Private Sub TransTypeEventHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTransacTypes.Click



Using rol As New MicroFour.StrataFrame.Security.BusinessObjects.SFSRolesBO

rol.FillAllByUser(MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.UserPK)



If rol.Seek("rl_Role='Warehouse Manager'") Then

LaunchForm(GetType(InventoryTransactListEditor))

Else

MicroFour.StrataFrame.Messaging.MessageForm.ShowMessage("Access Denied.")

End If



End Using



End Sub







Even if the user has the IsAdministrator check he wont be able to Launch the Dialog if he doesn´t belong to the requested role.

Note: I haven´t tested the result when deleting the "Warehouse Manager" Role from the Security Tables.



Cheers Cool

------------------------------------------------------------------------
I would like to change the world, but they don´t give me the source code.
MS Windows 7 Ultimate 64-Bit
Intel(R) Core(TM)2 Quad CPU Q9300 2.50 GHz
6.00 GB of RAM, NVIDIA GeForce 9800 GT

MacBook Pro i5 OSX Lion
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks for the example!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search