The SPWeb.EnsureUser method is a handy method made available by the SPWeb object. This method will check whether the logon name is a member of the SPWeb and if not, it will add it. For example, this can be used in an Event Receiver that handles an ItemAdded event and needs to ensure that the Approver or the original Author of a document has access to it in the new SPWeb location. The user object returned is an instance of SPUser and can be used to retrieve information as necessary.

SPUser user = web.EnsureUser(account);

This code could throw an exception if the context running doesn't have the appropriate permissions. The best way to implement this method is by using SPSecurity.RunWithElevatedPrivileges. Here is a good writeup by Dan Parker on how best to implement this.

References