I want to know the best optimized way to access current logged in user's information and set few flags. I have a controller extension and I have set flags in constructor like this:
User u = [SELECT ID,Name,ProfileID,Profile.Name,UserRole.Name,UserRole.ID,Team_Lead__c,Leading_Teams__c,Department,Desk__c
FROM User
WHERE id=:userId];
if(u.UserRole.Name != null && u.UserRole.Name.contains('xyz')){
isComUser = true;
}
if(u.UserRole.Name != null && u.UserRole.Name.contains('pqr')) {
isFPUser = true;
}
...and the conditions go on.. There are so many conditions that constructor has become really big & unmanagable.
Is there a good way to do this? Thanks in advance