Skip to content

Commit 7aaea4c

Browse files
author
gauffininteractive
committed
Corrected the invitation routine
1 parent 0f1d3c3 commit 7aaea4c

File tree

10 files changed

+47
-42
lines changed

10 files changed

+47
-42
lines changed

src/Server/OneTrueError.App/Core/Invitations/CommandHandlers/AcceptInvitationHandler.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ public async Task<AcceptInvitationReply> ExecuteAsync(AcceptInvitation request)
4141

4242
await _accountRepository.CreateAsync(account);
4343

44-
44+
4545
Thread.CurrentPrincipal = new OneTruePrincipal(account.UserName);
4646
await _eventBus.PublishAsync(new AccountActivated(account.Id, account.UserName)
4747
{
4848
EmailAddress = account.Email
4949
});
50-
await _eventBus.PublishAsync(new InvitationAccepted(account.Id, invitation.InvitedBy, account.UserName)
50+
var e = new InvitationAccepted(account.Id, invitation.InvitedBy, account.UserName)
5151
{
5252
EmailAddress = account.Email,
5353
ApplicationIds = invitation.Invitations.Select(x => x.ApplicationId).ToArray()
54-
});
54+
};
55+
await _eventBus.PublishAsync(e);
5556

5657
return new AcceptInvitationReply(account.Id, account.UserName);
5758
}

src/Server/OneTrueError.App/Core/Invitations/CommandHandlers/InviteUserHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public async Task ExecuteAsync(InviteUser command)
8383
protected virtual async Task SendInvitationEmailAsync(Invitation invitation, string reason)
8484
{
8585
var config = ConfigurationStore.Instance.Load<BaseConfiguration>();
86-
var url = config.BaseUrl;
86+
var url = config.BaseUrl.ToString().TrimEnd('/');
8787
if (string.IsNullOrEmpty(reason))
8888
reason = "";
8989
else

src/Server/OneTrueError.SqlServer/Core/Users/ApplicationTeamMemberMapper.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ public class ApplicationTeamMemberMapper : CrudEntityMapper<ApplicationTeamMembe
88
{
99
public ApplicationTeamMemberMapper() : base("ApplicationMembers")
1010
{
11-
/* [AccountId] INT NULL foreign key references Accounts (Id),
12-
[ApplicationId] INT NOT NULL foreign key references Applications (Id),
13-
[EmailAddress] nvarchar(255) not null,
14-
[AddedAtUtc] DATETIME NOT NULL,
15-
[AddedByName] VARCHAR (50) NOT NULL,
16-
[Roles] VARCHAR (255) NOT NULL,*/
11+
Property(x => x.EmailAddress)
12+
.PrimaryKey(false);
13+
1714
Property(x => x.AccountId)
1815
.ToColumnValue(x => x == 0 ? (object) DBNull.Value : x)
1916
.ToPropertyValue(x => x is DBNull ? 0 : (int) x);
2017

21-
Property(x => x.UserName).NotForCrud();
18+
Property(x => x.UserName)
19+
.NotForCrud();
20+
2221
Property(x => x.Roles)
2322
.ToColumnValue(x => string.Join(",", x))
2423
.ToPropertyValue(x => ((string) x).Split(','));

src/Server/OneTrueError.SqlServer/Database.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,6 @@ BEGIN
325325

326326
);
327327
END
328+
329+
insert into Applications (Name, AppKey, CreatedById, CreatedAtUtc, ApplicationType, SharedSecret) VALUES('test', '13d82df603a845c7a27164c4fec19dd6', 1, GetUtcDate(), 'DesktopApplication', '6f0a0a7fac6d42caa7cc47bb34a6520b');
330+
insert into ApplicationMembers (AccountId, ApplicationId, EmailAddress, AddedAtUtc, AddedByName, Roles) SELECT 1, 1, (SELECT TOP 1 email FROM accounts), GetUtcDate(), 'admin', 'Admin,Member';

src/Server/OneTrueError.Web/Areas/Installation/Views/Sql/Index.cshtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@
3535
by taking the SqlServer class library and convert it to a library for your favorite DB engine.
3636
</em>
3737
</p>
38+
3839
<h3>Example</h3>
3940
<pre><code>Data Source=(localdb)\ProjectsV12;Initial Catalog=OneTrueError;Integrated Security=True;Connect Timeout=30;</code></pre>
41+
42+
<h2>Tip!</h2>
43+
<p>Do you want to give permissions to the IIS app pool? Add <em>"IIS APPPOOL\YourAppPool"</em> as the windows account in SQL Server Management Studio. </p>
44+
<p>For instance <code>IIS APPPOOL\DefaultAppPool</code>.</p>
4045
</div>
4146
</div>
4247
</div>

src/Server/OneTrueError.Web/OneTrueError.Web.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<DefineConstants>DEBUG;TRACE</DefineConstants>
3737
<ErrorReport>prompt</ErrorReport>
3838
<WarningLevel>4</WarningLevel>
39+
<PublishDatabases>false</PublishDatabases>
3940
</PropertyGroup>
4041
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
4142
<DebugType>pdbonly</DebugType>
@@ -489,9 +490,9 @@
489490
<Content Include="Content\bootstrap\bootstrap.less" />
490491
<Content Include="Content\bootstrap\badges.less" />
491492
<Content Include="Content\bootstrap\alerts.less" />
492-
<None Include="Properties\PublishProfiles\deoply.pubxml" />
493493
<None Include="Properties\PublishProfiles\LocalPublish.pubxml" />
494-
<None Include="Properties\PublishProfiles\WebPI.pubxml" />
494+
<None Include="Properties\PublishProfiles\WebPI Site.pubxml" />
495+
<None Include="Properties\PublishProfiles\WebPI VDir.pubxml" />
495496
<None Include="Scripts\jquery-1.10.2.intellisense.js" />
496497
<Content Include="Scripts\Chart.min.js" />
497498
<Content Include="Scripts\Griffin.Yo.js" />

src/Server/OneTrueError.Web/Properties/PublishProfiles/deoply.pubxml renamed to src/Server/OneTrueError.Web/Properties/PublishProfiles/WebPI Site.pubxml

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,42 @@ by editing this MSBuild file. In order to learn more about this please visit htt
1010
<LastUsedPlatform>Any CPU</LastUsedPlatform>
1111
<SiteUrlToLaunchAfterPublish />
1212
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
13-
<ExcludeApp_Data>False</ExcludeApp_Data>
14-
<DesktopBuildPackageLocation>D:\src\gauffininteractive\OneTrueEror.WebPi\OneTrueError2.zip</DesktopBuildPackageLocation>
13+
<PrecompileBeforePublish>True</PrecompileBeforePublish>
14+
<EnableUpdateable>True</EnableUpdateable>
15+
<DebugSymbols>False</DebugSymbols>
16+
<WDPMergeOption>DonotMerge</WDPMergeOption>
17+
<ExcludeApp_Data>True</ExcludeApp_Data>
18+
<DesktopBuildPackageLocation>..\..\..\Release\WebPI Site</DesktopBuildPackageLocation>
1519
<PackageAsSingleFile>true</PackageAsSingleFile>
16-
<DeployIisAppPath>Default web site/OneTrueError</DeployIisAppPath>
20+
<DeployIisAppPath>OneTrueError</DeployIisAppPath>
1721
<PublishDatabaseSettings>
1822
<Objects xmlns="">
19-
<ObjectGroup Name="Db" Order="1" Enabled="True">
20-
<Destination Path="Data Source=.;Initial Catalog=OneTrueError;Integrated Security=True" />
21-
<Object Type="DbDacFx" Enabled="True">
23+
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
24+
<Destination Path="" />
25+
<Object Type="DbCodeFirst">
26+
<Source Path="DBContext" DbContext="OneTrueError.Web.Models.ApplicationDbContext, OneTrueError.Web" Origin="Convention" />
27+
</Object>
28+
</ObjectGroup>
29+
<ObjectGroup Name="Db" Order="2" Enabled="False">
30+
<Destination Path="" />
31+
<Object Type="DbDacFx">
2232
<PreSource Path="Data Source=.;Initial Catalog=OneTrueError;Integrated Security=True;Connect Timeout=30" includeData="False" />
2333
<Source Path="$(IntermediateOutputPath)AutoScripts\Db_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
2434
</Object>
2535
<UpdateFrom Type="Web.Config">
2636
<Source MatchValue="Data Source=.;Initial Catalog=OneTrueError;Integrated Security=True;Connect Timeout=30;multipleactiveresultsets=true" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
2737
</UpdateFrom>
28-
<Object Type="DbFullSql">
29-
<Source Path="..\OneTrueError.SqlServer\Database.sql" Transacted="False" />
30-
</Object>
31-
<Object Type="DbFullSql">
32-
<Source Path="..\..\..\..\OneTrueEror.WebPi\package\settings.sql" Transacted="False" />
33-
</Object>
34-
</ObjectGroup>
35-
<ObjectGroup Name="DefaultConnection" Order="2" Enabled="False">
36-
<Destination Path="" />
37-
<Object Type="DbCodeFirst">
38-
<Source Path="DBContext" DbContext="OneTrueError.Web.Models.ApplicationDbContext, OneTrueError.Web" Origin="Convention" />
39-
</Object>
4038
</ObjectGroup>
4139
</Objects>
4240
</PublishDatabaseSettings>
43-
<PrecompileBeforePublish>True</PrecompileBeforePublish>
44-
<EnableUpdateable>True</EnableUpdateable>
45-
<DebugSymbols>False</DebugSymbols>
46-
<WDPMergeOption>DonotMerge</WDPMergeOption>
4741
</PropertyGroup>
4842
<ItemGroup>
4943
<MSDeployParameterValue Include="$(DeployParameterPrefix)Db-Web.config Connection String">
50-
<ParameterValue>data source=.;initial catalog=OneTrueError;integrated security=True;MultipleActiveResultSets=true</ParameterValue>
44+
<UpdateDestWebConfig>False</UpdateDestWebConfig>
45+
</MSDeployParameterValue>
46+
<MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String">
47+
<UpdateDestWebConfig>False</UpdateDestWebConfig>
5148
</MSDeployParameterValue>
52-
<MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String" />
5349
</ItemGroup>
5450
<ItemGroup>
5551
<_ConnectionStringsToInsert Include="DefaultConnection" />

src/Server/OneTrueError.Web/Properties/PublishProfiles/WebPI.pubxml renamed to src/Server/OneTrueError.Web/Properties/PublishProfiles/WebPI VDir.pubxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ by editing this MSBuild file. In order to learn more about this please visit htt
1010
<LastUsedPlatform>Any CPU</LastUsedPlatform>
1111
<SiteUrlToLaunchAfterPublish />
1212
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
13-
<ExcludeApp_Data>False</ExcludeApp_Data>
14-
<DesktopBuildPackageLocation>D:\src\gauffin.com\OneTrueError.main\WebPI</DesktopBuildPackageLocation>
13+
<ExcludeApp_Data>True</ExcludeApp_Data>
14+
<DesktopBuildPackageLocation>..\..\..\Release\WebPI VDir</DesktopBuildPackageLocation>
1515
<PackageAsSingleFile>true</PackageAsSingleFile>
1616
<DeployIisAppPath>Default Web Site/OneTrueError</DeployIisAppPath>
1717
<PublishDatabaseSettings>

src/Server/OneTrueError.Web/Views/Application/Team.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<hr />
1717
<h3>Pending invites</h3>
1818
<div data-collection="Invited">
19-
<span data-name="EmailAddress"></span>
19+
<div data-name="EmailAddress"></div>
2020
</div>
2121
<hr />
2222
<button id="ShowInviteDlg" class="btn btn-primary">Invite</button>

src/Server/OneTrueError.Web/Views/Shared/_Layout.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@using OneTrueError.Infrastructure.Configuration
33
@using OneTrueError.Web.Models
44
@{
5-
if (Request.Url.Host == "http://localhost:50473")
5+
if (Request.Url?.Port == 50473)
66
{
77
ViewBag.AppUrl = "http://localhost:50473/";
88
}
@@ -145,7 +145,7 @@
145145
@if (SessionUser.IsAuthenticated)
146146
{
147147
<script type="text/javascript">
148-
@if (Url.Content("~/") == Request.Url.AbsolutePath)
148+
@if (Url.Content("~/").Equals(Request.Url.AbsolutePath, StringComparison.OrdinalIgnoreCase))
149149
{
150150
<text>doMe();</text>
151151
}

0 commit comments

Comments
 (0)