1 25 26 29 package net.killingar.forum.internal.caches; 30 31 import net.killingar.forum.internal.AccessLevel; 32 import net.killingar.forum.internal.NamedItemImpl; 33 import net.killingar.forum.internal.User; 34 import net.killingar.forum.internal.managers.ForumManager; 35 36 import java.sql.SQLException ; 37 38 public class UserItem extends NamedItemImpl 39 { 40 private User publicObject, restrictedObject; 41 42 public UserItem(User inPublicObject, User inRestrictedObject) 43 { 44 super(inPublicObject.getId(), inPublicObject.getName()); 45 46 publicObject = inPublicObject; 47 restrictedObject = inRestrictedObject; 48 } 49 50 public User getUser(ForumManager manager) throws SQLException 51 { 52 if (manager.hasAccess(manager.getUserID(), AccessLevel.viewUser) || manager.sharesRestrictedGroup(manager.getUserID(), getId())) 53 return restrictedObject; 54 else 55 return publicObject; 56 } 57 } | Popular Tags |