public UserSession(iSystem system, User user, string fromIPAddress) { this.System = system; this.User = user; this.FromIPAddress = fromIPAddress; this.SessionPeriod = new TimeInterval(DateTime.Now); }
public virtual List <UserRole> GetEffectiveRoles(iSystem application) { List <UserRole> roles = new List <UserRole>(); foreach (UserRole ur in UserRoles) { if (ur.EffectivePeriod.IsEffectiveOn(DateTime.Now) && ur.Role.SystemID == application.SystemID) { roles.Add(ur); } } return(roles); }
public virtual RoleMenu GetEffectiveMenuPermission(iSystem system, int menuID) { RoleMenu effectiveRoleMenu = null; foreach (UserRole ur in this.GetEffectiveRoles(system)) { foreach (RoleMenu rm in ur.Role.Menus) { if (rm.Menu.Id == menuID) { rm.MergeMenuPermissionsTo(ref effectiveRoleMenu); } } } return(effectiveRoleMenu); }
public virtual int GetEffectivePrivilegeLevel(iSystem system) { int effectivePrivilegeLevel = 0; foreach (UserRole ur in this.GetEffectiveRoles(system)) { if (ur.EffectivePeriod.IsEffectiveOn(DateTime.Now) && ur.Role.SystemID == system.SystemID) { if (effectivePrivilegeLevel < ur.Role.PrivilegeLevel) { effectivePrivilegeLevel = ur.Role.PrivilegeLevel; } } } return(effectivePrivilegeLevel); }
public Context(iSystem system, string fromIPAddress) { this.MySystem = system; this.FromIPAddress = fromIPAddress; }
//public Context() //{ //} public Context(iSystem system, ISessionFactory sessionFactory) { this.MySystem = system; this.PersistenceSession = sessionFactory.OpenSession(); }