using System.Security.Principal; using System.Text; using Nexus.Core.Profile; namespace PhoneBook.Core { /// /// Extend UserProfile to include properties specific to this application, /// such as IsEditor. /// /// public class AppUserProfile : UserProfile { /// /// Provide a field for IsEditor property. /// private bool _IsEditor = false; /// /// Indicate whether user has editing priveleges. /// /// public bool IsEditor { get { return _IsEditor; } set { _IsEditor = value; } } /// /// Provide a field for Entry property. /// /// private AppEntry _Entry; /// /// Record directory entry for user. /// /// public AppEntry Entry { get { return _Entry; } set { _Entry = value; if (_Entry != null) { StringBuilder sb = new StringBuilder(); sb.Append(_Entry.first_name); sb.Append(" "); sb.Append(Entry.last_name); FullName = sb.ToString().Trim(); } } } /// /// Provide a field for FullName property. /// /// private string _FullName; /// /// Record the user's full name (first and last names). /// /// public string FullName { get { return _FullName; } set { _FullName = value; } } /// /// Instantiate from an IIdentity. /// /// Identity to copy for this profile. /// public AppUserProfile(IIdentity id) { Principal = new UserPrincipal(id); } } }