quarta-feira, 14 de janeiro de 2015

Liferay - How to Get User Data

How to Get User Data

To access authenticated user data you can use the ThemeDisplay class.

All you have to do is instantiate the class like this:


ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest .getAttribute(WebKeys.THEME_DISPLAY);


With the ThemeDisplay object you can then get an instance of the User class:

User user = themeDisplay.getUser();


Now you can access all of these User attributes:

//     uuid
//     userId
//     companyId
//     createDate
//     modifiedDate
//     defaultUser
//     contactId
//     password
//     passwordEncrypted
//     passwordReset
//     passwordModifiedDate
//     digest
//     reminderQueryQuestion
//     reminderQueryAnswer
//     graceLoginCount
//     screenName
//     emailAddress
//     facebookId
//     ldapServerId
//     openId
//     portraitId
//     languageId
//     timeZoneId
//     greeting
//     comments
//     firstName
//     middleName
//     lastName
//     jobTitle
//     loginDate
//     loginIP
//     lastLoginDate
//     lastLoginIP
//     lastFailedLoginDate
//     failedLoginAttempts
//     lockout
//     lockoutDate
//     agreedToTermsOfUse
//     emailAddressVerified
//     status


Have fun!

Sem comentários:

Enviar um comentário