public void Handle(AddedRoleToRoleGroup message)
        {
            HashSet <Guid> roles;

            if (!_rolesInRoleGroup.TryGetValue(message.RoleGroupId, out roles))
            {
                roles = new HashSet <Guid>();
                _rolesInRoleGroup.Add(message.RoleGroupId, roles);
            }
            roles.Add(message.RoleId);
        }
Beispiel #2
0
        public void Handle(AddedRoleToRoleGroup message)
        {
            var tempTableName = "#AffectedUserAccounts" + _random.Next();

            _observer.OnNext(
                new SqlTextStatement(
                    string.Format(
                        "CREATE TABLE {0} (UserAccountId UNIQUEIDENTIFIER) " + Environment.NewLine +
                        "INSERT INTO {0} " + Environment.NewLine +
                        "SELECT UserAccountId FROM UserAccountEffectiveRoles WHERE RoleGroupId = @RoleGroupId " +
                        Environment.NewLine +
                        "INSERT INTO UserAccountEffectiveRoles (UserAccountId, RoleGroupId, RoleId) " + Environment.NewLine +
                        "SELECT UserAccountId, @RoleGroupId, @RoleId FROM {0} " + Environment.NewLine +
                        "DROP TABLE {0}",
                        tempTableName
                        ),
                    new { RoleGroupId = message.RoleGroupId, RoleId = message.RoleId }));
        }
Beispiel #3
0
 void When(AddedRoleToRoleGroup @event)
 {
     _roles.Add(new RoleId(@event.RoleId));
 }