public TenantDeactivated(TenantId tenantId) { this.TenantId = tenantId.Id; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public ICollection<Role> AllRoles(TenantId tenantId) { ICriteria criteria = _session.CreateCriteria<Role>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); return criteria.List<Role>(); }
public Tenant Get(TenantId tenantId) { ICriteria criteria = _session.CreateCriteria<Tenant>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); return criteria.List<Tenant>().SingleOrDefault(); }
public Group(TenantId tenantId, string name, string description) : this() { this.TenantId = tenantId; this.Name = name; this.Description = description; }
public void ProvisionRole(ProvisionRoleCommand command) { TenantId tenantId = new TenantId(command.TenantId); Tenant tenant = _tenantRepository.Get(tenantId); Role role = tenant.ProvisionRole(command.RoleName, command.Description, command.SupportsNesting); _roleRepository.Add(role); }
public GroupProvisioned(TenantId tenantId, string name) { this.Name = name; this.TenantId = tenantId.Id; this.OccurredOn = DateTime.Now; this.EventVersion = 1; }
public Role RoleNamed(TenantId tenantId, string roleName) { ICriteria criteria = _session.CreateCriteria<Role>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); criteria.Add(Restrictions.Eq("Name", roleName)); return criteria.List<Role>().SingleOrDefault(); }
public User UserWithUserName(TenantId tenantId, string userName) { ICriteria criteria = _session.CreateCriteria<User>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); criteria.Add(Restrictions.Eq("UserName", userName)); return criteria.List<User>().SingleOrDefault(); }
public ICollection<Group> AllGroups(TenantId tenantId) { ICriteria criteria = _session.CreateCriteria<Group>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); criteria.Add(Restrictions.Not(Restrictions.Like("Name", Group.RoleGroupPrefix, MatchMode.Start))); return criteria.List<Group>(); }
public UserPasswordChanged(TenantId tenantId, string userName) { this.TenantId = tenantId.Id; this.UserName = userName; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public bool IsUserInRole(TenantId tenantId, string userName, string roleName) { AssertionConcern.NotNull(tenantId, "TenantId must not be null."); AssertionConcern.NotEmpty(userName, "User name must not be provided."); AssertionConcern.NotEmpty(roleName, "Role name must not be null."); User user = _userRepository.UserWithUserName(tenantId, userName); return user != null && this.IsUserInRole(user, roleName); }
public Role(TenantId tenantId, string name, string description, bool supportsNesting) { this.TenantId = tenantId; this.Name = name; this.Description = description; this.SupportsNesting = supportsNesting; this._group = CreateInternalGroup(); }
public User UserFromAuthenticCredentials(TenantId tenantId, string userName, string encryptedPassword) { ICriteria criteria = _session.CreateCriteria<User>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); criteria.Add(Restrictions.Eq("UserName", userName)); criteria.Add(Restrictions.Eq("Password", encryptedPassword)); return criteria.List<User>().SingleOrDefault(); }
public PersonContactInformationChanged(TenantId tenantId, string userName, ContactInformation contactInformation) { this.TenantId = tenantId.Id; this.UserName = userName; this.ContactInformation = contactInformation; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public GroupGroupRemoved(TenantId tenantId, string groupName, string nestedGroupName) { this.TenantId = tenantId.Id; this.GroupName = groupName; this.NestedGroupName = nestedGroupName; this.OccurredOn = DateTime.Now; this.EventVersion = 1; }
public GroupUnassignedFromRole(TenantId tenantId, string roleName, string groupName) { this.TenantId = tenantId.Id; this.RoleName = roleName; this.GroupName = groupName; this.OccurredOn = DateTime.Now; this.EventVersion = 1; }
public UserEnablementChanged(TenantId tenantId, string userName, Enablement enablement) { this.TenantId = tenantId.Id; this.UserName = userName; this.Enablement = enablement; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public InvitationDescriptor(TenantId tenantId, string invitationId, string description, DateTime startingOn, DateTime until) { this.TenantId = tenantId; this.InvitationId = invitationId; this.Description = description; this.StartingOn = startingOn; this.Until = until; }
public PersonNameChanged(TenantId tenantId, string userName, FullName name) { this.TenantId = tenantId.Id; this.UserName = userName; this.Name = name; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public UserUnassignedFromRole(TenantId tenantId, string roleName, string userName) { this.TenantId = tenantId.Id; this.RoleName = roleName; this.UserName = userName; this.OccurredOn = DateTime.Now; this.EventVersion = 1; }
public GroupUserAdded(TenantId tenantId, string groupName, string userName) { this.TenantId = tenantId.Id; this.GroupName = groupName; this.UserName = userName; this.OccurredOn = DateTime.Now; this.EventVersion = 1; }
public ICollection<User> AllSimilarlyNamedUsers(TenantId tenantId, string firstNamePrefix, string lastNamePrefix) { ICriteria criteria = _session.CreateCriteria<User>() .Add(Restrictions.Eq("TenantId", tenantId)); criteria.CreateCriteria("Person") .Add(Restrictions.Like("Name.FirstName", firstNamePrefix, MatchMode.Start)) .Add(Restrictions.Like("Name.LastName", lastNamePrefix, MatchMode.Start)); return criteria.List<User>(); }
public GroupMember(TenantId tenantId, string name, GroupMemberType type) { AssertionConcern.NotNull(tenantId, "The tenantId must be provided."); AssertionConcern.NotEmpty(name, "Member name is required."); AssertionConcern.Length(name, 1, 100, "Member name must be 100 characters or less."); this.TenantId = tenantId; this.Name = name; this.Type = type; }
public UserRegistered(TenantId tenantId, string userName, FullName name, EmailAddress emailAddress) { this.TenantId = tenantId.Id; this.UserName = userName; this.Name = name; this.EmailAddress = emailAddress; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public Group GroupNamed(TenantId tenantId, string groupName) { if(groupName.StartsWith(Group.RoleGroupPrefix)) { throw new InvalidOperationException("May not find internal groups."); } ICriteria criteria = _session.CreateCriteria<Group>(); criteria.Add(Restrictions.Eq("TenantId", tenantId)); criteria.Add(Restrictions.Eq("Name", groupName)); return criteria.List<Group>().SingleOrDefault(); }
public void AssignUserToRole(AssignUserToRoleCommand command) { TenantId tenantId = new TenantId(command.TenantId); User user = this._userRepository.UserWithUserName(tenantId, command.UserName); if(user!=null) { Role role = _roleRepository.RoleNamed(tenantId, command.RoleName); if(role!=null) { role.AssignUser(user); } } }
public TenantAdministratorRegistered( TenantId tenantId, string name, FullName administorName, EmailAddress emailAddress, string userName, string temporaryPassword) { this.TenantId = tenantId.Id; this.Name = name; this.AdministorName = administorName; this.TemporaryPassword = temporaryPassword; this.EventVersion = 1; this.OccurredOn = DateTime.Now; }
public UserAssignedToRole(TenantId tenantId, string roleName, string userName, FullName fullName, EmailAddress emailAddress) { this.TenantId = tenantId.Id; this.RoleName = roleName; this.UserName = userName; this.FullName = fullName; this.EmailAddress = emailAddress; this.OccurredOn = DateTime.Now; this.EventVersion = 1; }
public User UserInRole(string tenantId, string userName, string roleName) { TenantId id = new TenantId(tenantId); User user = _userRepository.UserWithUserName(id, userName); if(user!=null) { Role role = this._roleRepository.RoleNamed(id, roleName); if(role!=null) { if(role.IsInRole(user, new GroupMemberService(this._userRepository, this._groupRepository))) { return user; } } } return null; }
public User(TenantId tenantId, string userName, string password, Enablement enablement, Person person) { this.TenantId = tenantId; this.UserName = userName; this.Enablement = enablement; this.Person = person; ProtectPassword("", password); person.User = this; DomainEventPublisher.Instance.Publish(new UserRegistered( tenantId, userName, person.Name, person.ContactInformation.EmailAddress)); }