Accessing logged in user information from inside a module

A

Andy B.

I have methods in a module that need to have access to the logged in users
information for logging purposes. How do I get access to the Membership and
MembershipUser objects in these methods without having to pass the objects
to them?
 
C

Cowboy \(Gregory A. Beamer\)

Those routines can instantiate the member objects, but if they are in a
library, it is better you instantiate and pass them. The main reason here is
separation of concerns. If the libraries are pulling Membership objects, you
make the library so it can only be used to log user info in a system that
uses the default method of setting up membership in the config file, which
means a web application only. If that constraint is not a horrible thing,
you can set up the class to do this, even if it breaks encapsulation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top