Remove DevicePermission and UserPermission.

This commit is contained in:
Jared Goodwin 2019-12-11 08:40:28 -08:00
parent 535a855625
commit 8189e237b3
30 changed files with 641 additions and 2365 deletions

View File

@ -277,8 +277,8 @@
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Debug (
if $(PlatformName) == Any CPU (
md "$(SolutionDir)Agent\bin\Debug\netcoreapp3.1\win10-x64\ScreenCast\"
copy /y "$(TargetDir)\*" "$(SolutionDir)Agent\bin\Debug\netcoreapp3.1\win10-x64\ScreenCast\"
md "$(SolutionDir)Agent\bin\Debug\netcoreapp3.1\ScreenCast\"
copy /y "$(TargetDir)\*" "$(SolutionDir)Agent\bin\Debug\netcoreapp3.1\ScreenCast\"
)
)</PostBuildEvent>
</PropertyGroup>

View File

@ -10,6 +10,7 @@ using Remotely.Server.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Remotely.Shared.ViewModels.Organization;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
@ -29,24 +30,7 @@ namespace Remotely.Server.API
private DataService DataService { get; }
private EmailSender EmailSender { get; }
private UserManager<RemotelyUser> UserManager { get; }
[HttpPost("AddUserPermission/{userID}")]
public IActionResult AddUserPermission(string userID, [FromBody]string permissionID)
{
if (!DataService.GetUserByName(User.Identity.Name).IsAdministrator)
{
return Unauthorized();
}
if (!ModelState.IsValid)
{
return BadRequest();
}
var result = DataService.AddPermissionToUser(User.Identity.Name, userID, permissionID.Trim(), out var errorMessage);
if (!result)
{
return BadRequest(errorMessage);
}
return Ok(permissionID);
}
[HttpPost("ChangeIsAdmin/{userID}")]
public IActionResult ChangeIsAdmin(string userID, [FromBody]bool isAdmin)
@ -90,47 +74,6 @@ namespace Remotely.Server.API
DataService.UpdateOrganizationName(User.Identity.Name, organizationName.Trim());
return Ok("ok");
}
[HttpDelete("Permission")]
public IActionResult Permission([FromBody]string permissionID)
{
if (!DataService.GetUserByName(User.Identity.Name).IsAdministrator)
{
return Unauthorized();
}
DataService.DeletePermission(User.Identity.Name, permissionID.Trim());
return Ok("ok");
}
[HttpPost("Permission")]
public IActionResult Permission([FromBody]Permission permission)
{
if (!DataService.GetUserByName(User.Identity.Name).IsAdministrator)
{
return Unauthorized();
}
if (!ModelState.IsValid)
{
return BadRequest();
}
var result = DataService.AddPermission(User.Identity.Name, permission, out var permissionID, out var errorMessage);
if (!result)
{
return BadRequest(errorMessage);
}
return Ok(permissionID);
}
[HttpDelete("RemovePermissionFromUser/{userID}/{permissionID}")]
public IActionResult RemovePermissionFromUser(string userID, string permissionID)
{
if (!DataService.GetUserByName(User.Identity.Name).IsAdministrator)
{
return Unauthorized();
}
DataService.RemovePermissionFromUser(User.Identity.Name, userID, permissionID.Trim());
return Ok("ok");
}
[HttpDelete("RemoveUserFromOrganization/{userID}")]
public IActionResult RemoveUserFromOrganization(string userID)
@ -143,6 +86,7 @@ namespace Remotely.Server.API
DataService.RemoveUserFromOrganization(User.Identity.Name, userID);
return Ok("ok");
}
[HttpPost("SendInvite")]
public async Task<IActionResult> SendInvite([FromBody]Invite invite)
{

View File

@ -26,33 +26,6 @@
</div>
</div>
</div>
<div class="row">
<div class="col-sm-8">
@* Permissions *@
<div class="form-group">
<label class="mb-1">Permission Groups</label>
<span id="permissionHelpButton" class="fas fa-question-circle pointer"></span>
<select id="permissionList" multiple class="form-control all-permissions-list mb-1">
@foreach (var permission in Model.PermissionList)
{
<option value="@permission.ID">@permission.Name</option>
}
</select>
<div class="text-right mb-3">
<button id="removePermissionButton" type="button" class="btn btn-secondary">Remove</button>
</div>
<div class="input-group">
<input id="permissionInput" placeholder="Add new permission" class="form-control" maxlength="100" />
<span class="input-group-btn">
<button id="addPermissionButton" type="button" class="btn btn-secondary">Add</button>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@ -65,7 +38,6 @@
<tr>
<th>User Name</th>
<th>Administrator</th>
<th>Permissions</th>
<th>Remove</th>
</tr>
</thead>
@ -82,7 +54,6 @@
{
<td class="middle-aligned text-center">@Html.CheckBoxFor(x => x.Users[i].IsAdmin, new { user = Model.Users[i].ID, @class = "user-is-admin-checkbox" })</td>
}
<td><button type="button" data-toggle="modal" data-target=".modal[user='@Model.Users[i].ID']" class="btn btn-primary">Permissions</button></td>
<td><button type="button" class="btn btn-danger remove-user-button" user="@Model.Users[i].ID">Remove</button></td>
</tr>
}
@ -154,51 +125,6 @@
</div>
</div>
</div>
@* Modals *@
@for (var i = 0; i < Model.Users.Count; i++)
{
<div user="@Model.Users[i].ID" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Permissions <span class="small text-muted">for @Model.Users[i].UserName</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<select multiple class="form-control user-permissions-list mb-1">
@foreach (var permission in Model.Users[i].Permissions)
{
<option value="@permission.ID">@permission.Name</option>
}
</select>
<div class="text-right mb-3">
<button type="button" class="btn btn-secondary remove-permission-from-user-button" user="@Model.Users[i].ID">
Remove
</button>
</div>
<div class="input-group">
<select class="form-control dropdown all-permissions-list">
@foreach (var permission in Model.PermissionList)
{
<option value="@permission.ID">@permission.Name</option>
}
</select>
<span class="input-group-btn">
<button type="button" class="btn btn-secondary add-permission-to-user-button" user="@Model.Users[i].ID">
Add
</button>
</span>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
}
}
else
{

View File

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Remotely.Shared.ViewModels.Organization;
namespace Remotely.Server.Areas.Identity.Pages.Account.Manage
{
@ -23,9 +24,6 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage
[StringLength(25)]
public string OrganizationName { get; set; }
[Display(Name = "Permission Groups")]
public List<Permission> PermissionList { get; set; }
[Display(Name = "Users")]
public List<OrganizationUser> Users { get; set; }
@ -42,34 +40,9 @@ namespace Remotely.Server.Areas.Identity.Pages.Account.Manage
{
ID = x.Id,
IsAdmin = x.IsAdministrator,
Permissions = x?.UserPermissionLinks?.Select(y => new Permission()
{
ID = y.PermissionGroupID,
Name = y.PermissionGroup.Name
})?.ToList(),
UserName = x.UserName
}).ToList();
foreach (var user in Users)
{
var permissions = DataService.GetUserPermissions(User.Identity.Name, user.ID);
if (permissions.Any())
{
user.Permissions = permissions?.Select(x => new Permission
{
ID = x.PermissionGroupID,
Name = x.PermissionGroup?.Name
}).ToList();
}
}
PermissionList = DataService.GetAllPermissions(User.Identity.Name).Select(x => new Permission()
{
ID = x.ID,
Name = x.Name
}).ToList();
Invites = DataService.GetAllInviteLinks(User.Identity.Name).Select(x => new Invite()
{
ID = x.ID,

View File

@ -30,10 +30,7 @@ namespace Remotely.Server.Data
public DbSet<InviteLink> InviteLinks { get; set; }
public DbSet<PermissionGroup> PermissionGroups { get; set; }
public DbSet<UserPermissionLink> UserPermissionLinks { get; set; }
public DbSet<DevicePermissionLink> DevicePermissionLinks { get; set; }
public DbSet<DeviceGroup> DeviceGroups { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
@ -53,9 +50,9 @@ namespace Remotely.Server.Data
builder.Entity<Organization>()
.HasMany(x => x.EventLogs)
.WithOne(x => x.Organization);
builder.Entity<Organization>()
.HasMany(x => x.PermissionGroups)
.WithOne(x => x.Organization);
builder.Entity<DeviceGroup>()
.HasMany(x => x.Devices)
.WithOne(x => x.DeviceGroup);
builder.Entity<Organization>()
.HasMany(x => x.InviteLinks)
.WithOne(x => x.Organization);
@ -95,34 +92,6 @@ namespace Remotely.Server.Data
x => JsonConvert.SerializeObject(x),
x => JsonConvert.DeserializeObject<List<Drive>>(x));
builder.Entity<UserPermissionLink>()
.HasKey(x => new { x.PermissionGroupID, x.RemotelyUserID });
builder.Entity<UserPermissionLink>()
.HasOne(x => x.RemotelyUser)
.WithMany(y => y.UserPermissionLinks)
.HasForeignKey(x => x.RemotelyUserID);
builder.Entity<UserPermissionLink>()
.HasOne(x => x.PermissionGroup)
.WithMany(y => y.UserPermissionLinks)
.HasForeignKey(x => x.PermissionGroupID);
builder.Entity<DevicePermissionLink>()
.HasKey(x => new { x.PermissionGroupID, x.DeviceID });
builder.Entity<UserPermissionLink>()
.HasOne(x => x.RemotelyUser)
.WithMany(y => y.UserPermissionLinks)
.HasForeignKey(x => x.RemotelyUserID);
builder.Entity<UserPermissionLink>()
.HasOne(x => x.PermissionGroup)
.WithMany(y => y.UserPermissionLinks)
.HasForeignKey(x => x.PermissionGroupID);
}
}
}

View File

@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Remotely.Shared.ViewModels.Organization;
namespace Remotely.Server.Data
{
@ -104,41 +105,24 @@ namespace Remotely.Server.Data
public bool DoesUserHaveAccessToDevice(string deviceID, RemotelyUser remotelyUser)
{
var targetDevice = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.ThenInclude(x => x.PermissionGroup)
.ThenInclude(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.ID == deviceID && x.OrganizationID == remotelyUser.OrganizationID);
return remotelyUser.IsAdministrator ||
targetDevice.DevicePermissionLinks.Count == 0 ||
targetDevice.DevicePermissionLinks.Any(x => x.PermissionGroup.UserPermissionLinks.Any(y => y.RemotelyUserID == remotelyUser.Id));
return RemotelyContext.Devices.Any(x => x.ID == deviceID && x.OrganizationID == remotelyUser.OrganizationID);
}
public bool DoesUserHaveAccessToDevice(string deviceID, string remotelyUserID)
{
var remotelyUser = RemotelyContext.Users.Find(remotelyUserID);
var targetDevice = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.ThenInclude(x => x.PermissionGroup)
.ThenInclude(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.ID == deviceID && x.OrganizationID == remotelyUser.OrganizationID);
return remotelyUser.IsAdministrator ||
targetDevice.DevicePermissionLinks.Count == 0 ||
targetDevice.DevicePermissionLinks.Any(x => x.PermissionGroup.UserPermissionLinks.Any(y => y.RemotelyUserID == remotelyUser.Id));
return RemotelyContext.Devices.Any(x => x.ID == deviceID && x.OrganizationID == remotelyUser.OrganizationID);
}
public string[] FilterDeviceIDsByUserPermission(string[] deviceIDs, RemotelyUser remotelyUser)
{
return RemotelyContext.Devices.Where(x =>
deviceIDs.Contains(x.ID) &&
x.OrganizationID == remotelyUser.OrganizationID &&
(
remotelyUser.IsAdministrator ||
x.DevicePermissionLinks.Count == 0 ||
x.DevicePermissionLinks.Any(y => y.PermissionGroup.UserPermissionLinks.Any(z => z.RemotelyUserID == remotelyUser.Id))
))
deviceIDs.Contains(x.ID) &&
x.OrganizationID == remotelyUser.OrganizationID
)
.Select(x => x.ID)
.ToArray();
}
@ -151,34 +135,11 @@ namespace Remotely.Server.Data
public IEnumerable<Device> GetAllDevicesForUser(string userID)
{
var user = RemotelyContext.Users
.Include(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.Id == userID);
var user = RemotelyContext.Users.FirstOrDefault(x => x.Id == userID);
var result = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.Where(x => x.OrganizationID == user.OrganizationID);
if (user.IsAdministrator)
{
return result;
}
else
{
return result.Where(x =>
x.DevicePermissionLinks.Count == 0 ||
x.DevicePermissionLinks.Any(y => y.PermissionGroup.UserPermissionLinks.Any(z => z.RemotelyUserID == user.Id)));
}
return RemotelyContext.Devices.Where(x => x.OrganizationID == user.OrganizationID);
}
public IEnumerable<PermissionGroup> GetAllPermissions(string userName)
{
return RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.PermissionGroups)
.FirstOrDefault(x => x.UserName == userName)
.Organization.PermissionGroups;
}
public CommandContext GetCommandContext(string commandContextID, string userName)
{
@ -208,52 +169,11 @@ namespace Remotely.Server.Data
public Device GetDeviceForUser(string userID, string deviceID)
{
var user = RemotelyContext.Users
.Include(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.Id == userID);
var user = RemotelyContext.Users.FirstOrDefault(x => x.Id == userID);
var result = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.Where(x =>
return RemotelyContext.Devices.FirstOrDefault(x =>
x.OrganizationID == user.OrganizationID &&
x.ID == deviceID);
if (!user.IsAdministrator)
{
result = result.Where(x =>
x.DevicePermissionLinks.Count == 0 ||
x.DevicePermissionLinks.Any(y => y.PermissionGroup.UserPermissionLinks.Any(z => z.RemotelyUserID == user.Id)));
}
return result.FirstOrDefault();
}
public IEnumerable<Device> GetDevicesAndPermissions(string userID, string[] deviceIDs)
{
var user = GetUserByID(userID);
var devices = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.Include("DevicePermissionLinks.PermissionGroup")
.Where(x => x.OrganizationID == user.OrganizationID && deviceIDs.Contains(x.ID))
.ToList();
return devices.Select(x => new Device()
{
DeviceName = x.DeviceName,
DevicePermissionLinks = x.DevicePermissionLinks.ToList()
});
}
public RemotelyUser GetUserAndPermissionsByID(string userID)
{
if (userID == null)
{
return null;
}
return RemotelyContext.Users
.Include(x => x.Organization)
.Include(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.Id == userID);
}
public RemotelyUser GetUserByID(string userID)
@ -279,24 +199,13 @@ namespace Remotely.Server.Data
public List<RemotelyUser> GetUsersWithAccessToDevice(IEnumerable<string> userIDs, Device device)
{
var targetDevice = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.ThenInclude(x => x.PermissionGroup)
.ThenInclude(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.ID == device.ID && x.OrganizationID == device.OrganizationID);
// Users within the target device's organization, where user ID is in the list of IDs passed in, and
// user is either an admin, the target device has no permissions assigned, or the target device is in a
// permission group that the user is also in.
var targetUsers = RemotelyContext.Users.Where(x =>
x.OrganizationID == device.OrganizationID &&
userIDs.Contains(x.Id)).ToList();
var authorizedUsers = targetUsers.Where(x =>
x.IsAdministrator ||
targetDevice.DevicePermissionLinks.Count == 0 ||
targetDevice.DevicePermissionLinks.Any(y => y.PermissionGroup.UserPermissionLinks.Any(z => z.RemotelyUserID == x.Id)));
return authorizedUsers.ToList();
return targetUsers.ToList();
}
public void RemoveDevices(string[] deviceIDs)
{
@ -370,95 +279,6 @@ namespace Remotely.Server.Data
return newInvite;
}
internal bool AddPermission(string userName, Permission permission, out string permissionID, out string errorMessage)
{
permissionID = null;
errorMessage = null;
var organization = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.PermissionGroups)
.FirstOrDefault(x => x.UserName == userName)
.Organization;
if (organization.PermissionGroups.Any(x => x.Name.ToLower() == permission.Name.ToLower()))
{
errorMessage = "Permission group already exists.";
return false;
}
var newPermission = new PermissionGroup()
{
Name = permission.Name,
Organization = organization
};
organization.PermissionGroups.Add(newPermission);
RemotelyContext.SaveChanges();
permissionID = newPermission.ID;
return true;
}
internal void AddPermissionToDevices(string userID, string[] deviceIDs, string groupName)
{
var user = RemotelyContext.Users
.Include(x => x.Organization)
.Include(x => x.Organization)
.ThenInclude(x => x.Devices)
.FirstOrDefault(x => x.Id == userID);
var group = user.Organization.PermissionGroups.FirstOrDefault(x => x.Name.ToLower() == groupName.ToLower());
foreach (var deviceID in deviceIDs)
{
if (user.Organization.Devices.Any(x => x.ID == deviceID))
{
var device = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.FirstOrDefault(x => x.ID == deviceID);
if (!device.DevicePermissionLinks.Any(x => x.PermissionGroupID == group.ID))
{
device.DevicePermissionLinks.Add(new DevicePermissionLink()
{
Device = device,
DeviceID = device.ID,
PermissionGroup = group,
PermissionGroupID = group.ID
});
RemotelyContext.Entry(device).State = EntityState.Modified;
}
}
}
RemotelyContext.SaveChanges();
}
internal bool AddPermissionToUser(string requesterUserName, string targetUserID, string permissionID, out string errorMessage)
{
errorMessage = null;
var requester = RemotelyContext.Users
.Include(x => x.Organization)
.FirstOrDefault(x => x.UserName == requesterUserName);
var user = RemotelyContext.Users
.Include(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.OrganizationID == requester.OrganizationID && x.Id == targetUserID);
if (user.UserPermissionLinks.Any(x => x.PermissionGroupID == permissionID))
{
errorMessage = "User is already in the permission group.";
return false;
}
var permissions = RemotelyContext.PermissionGroups
.Include(x => x.Organization)
.Where(x => x.Organization.ID == requester.Organization.ID);
var permission = permissions.FirstOrDefault(x => x.ID == permissionID);
user.UserPermissionLinks.Add(new UserPermissionLink()
{
PermissionGroup = permission,
PermissionGroupID = permission.ID,
RemotelyUser = user,
RemotelyUserID = user.Id
});
RemotelyContext.SaveChanges();
return true;
}
internal string AddSharedFile(IFormFile file, string organizationID)
{
var expirationDate = DateTime.Now.AddDays(-AppConfig.DataRetentionInDays);
@ -537,27 +357,6 @@ namespace Remotely.Server.Data
RemotelyContext.SaveChanges();
}
internal void DeletePermission(string userName, string permissionID)
{
var organization = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.PermissionGroups)
.FirstOrDefault(x => x.UserName == userName)
.Organization;
var permissionGroup = organization.PermissionGroups.FirstOrDefault(x => x.ID == permissionID);
RemotelyContext.PermissionGroups.Remove(permissionGroup);
RemotelyContext.SaveChanges();
}
internal bool DoesGroupExist(string userID, string groupName)
{
var user = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.PermissionGroups)
.FirstOrDefault(x => x.Id == userID);
return user.Organization.PermissionGroups.Any(x => x.Name.ToLower() == groupName.ToLower());
}
internal ICollection<InviteLink> GetAllInviteLinks(string userName)
{
@ -600,17 +399,7 @@ namespace Remotely.Server.Data
.UserOptions;
}
internal IEnumerable<UserPermissionLink> GetUserPermissions(string requesterUserName, string targetID)
{
var requester = GetUserByName(requesterUserName);
var targetUser = RemotelyContext.Users
.Include(x => x.Organization)
.Include("UserPermissionLinks.PermissionGroup")
.FirstOrDefault(x => x.OrganizationID == requester.OrganizationID &&
x.Id == targetID);
return targetUser.UserPermissionLinks;
}
internal bool JoinViaInvitation(string userName, string inviteID)
{
@ -628,13 +417,11 @@ namespace Remotely.Server.Data
var user = RemotelyContext.Users
.Include(x => x.Organization)
.Include(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.UserName == userName);
user.Organization = invite.Organization;
user.OrganizationID = invite.Organization.ID;
user.IsAdministrator = invite.IsAdmin;
user.UserPermissionLinks.Clear();
invite.Organization.RemotelyUsers.Add(user);
RemotelyContext.SaveChanges();
@ -643,47 +430,6 @@ namespace Remotely.Server.Data
RemotelyContext.SaveChanges();
return true;
}
internal void RemovePermissionFromDevices(string userID, string[] deviceIDs, string groupName)
{
var user = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.Devices)
.FirstOrDefault(x => x.Id == userID);
var group = user.Organization.PermissionGroups.FirstOrDefault(x => x.Name.ToLower() == groupName.ToLower());
foreach (var deviceID in deviceIDs)
{
if (user.Organization.Devices.Any(x => x.ID == deviceID))
{
var device = RemotelyContext.Devices
.Include(x => x.DevicePermissionLinks)
.FirstOrDefault(x => x.ID == deviceID);
foreach (var permission in device.DevicePermissionLinks.ToList().Where(x => x.PermissionGroupID == group.ID))
{
device.DevicePermissionLinks.Remove(permission);
}
RemotelyContext.Entry(device).State = EntityState.Modified;
}
}
RemotelyContext.SaveChanges();
}
internal void RemovePermissionFromUser(string requesterUserName, string targetUserID, string permissionID)
{
var requester = RemotelyContext.Users
.Include(x => x.Organization)
.ThenInclude(x => x.RemotelyUsers)
.ThenInclude(x => x.UserPermissionLinks)
.FirstOrDefault(x => x.UserName == requesterUserName);
var target = requester.Organization.RemotelyUsers.FirstOrDefault(x => x.Id == targetUserID);
foreach (var permission in target.UserPermissionLinks.ToList().Where(x => x.PermissionGroupID == permissionID))
{
target.UserPermissionLinks.Remove(permission);
}
RemotelyContext.Entry(target).State = EntityState.Modified;
RemotelyContext.SaveChanges();
}
internal void RemoveUserFromOrganization(string requesterUserName, string targetUserID)
{

View File

@ -1,525 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Remotely.Server.Data;
namespace Remotely.Server.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190405052943_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("RemotelyUsers");
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Remotely_Shared.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandMode");
b.Property<string>("CommandResults");
b.Property<string>("CommandText");
b.Property<string>("OrganizationID");
b.Property<string>("PSCoreResults");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderUserID");
b.Property<string>("TargetDeviceIDs");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("CommandContexts");
});
modelBuilder.Entity("Remotely_Shared.Models.Device", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CurrentUser");
b.Property<string>("DeviceName");
b.Property<string>("Drives");
b.Property<double>("FreeMemory");
b.Property<double>("FreeStorage");
b.Property<bool>("Is64Bit");
b.Property<bool>("IsOnline");
b.Property<DateTime>("LastOnline");
b.Property<int>("OSArchitecture");
b.Property<string>("OSDescription");
b.Property<string>("OrganizationID");
b.Property<string>("Platform");
b.Property<int>("ProcessorCount");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Tags")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalStorage");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("Devices");
});
modelBuilder.Entity("Remotely_Shared.Models.DevicePermissionLink", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("DeviceID");
b.HasKey("PermissionGroupID", "DeviceID");
b.HasIndex("DeviceID");
b.ToTable("DevicePermissionLinks");
});
modelBuilder.Entity("Remotely_Shared.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("EventType");
b.Property<string>("Message");
b.Property<string>("OrganizationID");
b.Property<string>("Source");
b.Property<string>("StackTrace");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("EventLogs");
});
modelBuilder.Entity("Remotely_Shared.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateSent");
b.Property<string>("InvitedUser");
b.Property<bool>("IsAdmin");
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("InviteLinks");
});
modelBuilder.Entity("Remotely_Shared.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("OrganizationName")
.HasMaxLength(25);
b.HasKey("ID");
b.ToTable("Organizations");
});
modelBuilder.Entity("Remotely_Shared.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Remotely_Shared.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("ContentType");
b.Property<byte[]>("FileContents");
b.Property<string>("FileName");
b.Property<string>("OrganizationID");
b.Property<DateTime>("Timestamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("SharedFiles");
});
modelBuilder.Entity("Remotely_Shared.Models.UserPermissionLink", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("RemotelyUserID");
b.HasKey("PermissionGroupID", "RemotelyUserID");
b.HasIndex("RemotelyUserID");
b.ToTable("UserPermissionLinks");
});
modelBuilder.Entity("Remotely_Shared.Models.RemotelyUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<bool>("IsAdministrator");
b.Property<string>("OrganizationID");
b.Property<string>("UserOptions");
b.HasIndex("OrganizationID");
b.ToTable("RemotelyUsers");
b.HasDiscriminator().HasValue("RemotelyUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely_Shared.Models.CommandContext", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("CommandContexts")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Shared.Models.Device", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("Devices")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Shared.Models.DevicePermissionLink", b =>
{
b.HasOne("Remotely_Shared.Models.Device", "Device")
.WithMany("DevicePermissionLinks")
.HasForeignKey("DeviceID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely_Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("DevicePermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely_Shared.Models.EventLog", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Shared.Models.InviteLink", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("InviteLinks")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Shared.Models.PermissionGroup", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Shared.Models.SharedFile", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("SharedFiles")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely_Shared.Models.UserPermissionLink", b =>
{
b.HasOne("Remotely_Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("UserPermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely_Shared.Models.RemotelyUser", "RemotelyUser")
.WithMany("UserPermissionLinks")
.HasForeignKey("RemotelyUserID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely_Shared.Models.RemotelyUser", b =>
{
b.HasOne("Remotely_Shared.Models.Organization", "Organization")
.WithMany("RemotelyUsers")
.HasForeignKey("OrganizationID");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Remotely.Server.Migrations
{
public partial class ResetUrl : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ResetUrl",
table: "InviteLinks",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ResetUrl",
table: "InviteLinks");
}
}
}

View File

@ -1,529 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Remotely.Server.Data;
namespace Remotely.Server.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190705195745_Device.AgentVersion")]
partial class DeviceAgentVersion
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("RemotelyUsers");
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Remotely.Shared.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("CommandMode");
b.Property<string>("CommandResults");
b.Property<string>("CommandText");
b.Property<string>("OrganizationID");
b.Property<string>("PSCoreResults");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderUserID");
b.Property<string>("TargetDeviceIDs");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("CommandContexts");
});
modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("AgentVersion");
b.Property<string>("CurrentUser");
b.Property<string>("DeviceName");
b.Property<string>("Drives");
b.Property<double>("FreeMemory");
b.Property<double>("FreeStorage");
b.Property<bool>("Is64Bit");
b.Property<bool>("IsOnline");
b.Property<DateTime>("LastOnline");
b.Property<int>("OSArchitecture");
b.Property<string>("OSDescription");
b.Property<string>("OrganizationID");
b.Property<string>("Platform");
b.Property<int>("ProcessorCount");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Tags")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalStorage");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("Devices");
});
modelBuilder.Entity("Remotely.Shared.Models.DevicePermissionLink", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("DeviceID");
b.HasKey("PermissionGroupID", "DeviceID");
b.HasIndex("DeviceID");
b.ToTable("DevicePermissionLinks");
});
modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<int>("EventType");
b.Property<string>("Message");
b.Property<string>("OrganizationID");
b.Property<string>("Source");
b.Property<string>("StackTrace");
b.Property<DateTime>("TimeStamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("EventLogs");
});
modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateSent");
b.Property<string>("InvitedUser");
b.Property<bool>("IsAdmin");
b.Property<string>("OrganizationID");
b.Property<string>("ResetUrl");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("InviteLinks");
});
modelBuilder.Entity("Remotely.Shared.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("OrganizationName")
.HasMaxLength(25);
b.HasKey("ID");
b.ToTable("Organizations");
});
modelBuilder.Entity("Remotely.Shared.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("ContentType");
b.Property<byte[]>("FileContents");
b.Property<string>("FileName");
b.Property<string>("OrganizationID");
b.Property<DateTime>("Timestamp");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("SharedFiles");
});
modelBuilder.Entity("Remotely.Shared.Models.UserPermissionLink", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("RemotelyUserID");
b.HasKey("PermissionGroupID", "RemotelyUserID");
b.HasIndex("RemotelyUserID");
b.ToTable("UserPermissionLinks");
});
modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<bool>("IsAdministrator");
b.Property<string>("OrganizationID");
b.Property<string>("UserOptions");
b.HasIndex("OrganizationID");
b.ToTable("RemotelyUsers");
b.HasDiscriminator().HasValue("RemotelyUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely.Shared.Models.CommandContext", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("CommandContexts")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("Devices")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.DevicePermissionLink", b =>
{
b.HasOne("Remotely.Shared.Models.Device", "Device")
.WithMany("DevicePermissionLinks")
.HasForeignKey("DeviceID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("DevicePermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("InviteLinks")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.PermissionGroup", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("SharedFiles")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.UserPermissionLink", b =>
{
b.HasOne("Remotely.Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("UserPermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.RemotelyUser", "RemotelyUser")
.WithMany("UserPermissionLinks")
.HasForeignKey("RemotelyUserID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("RemotelyUsers")
.HasForeignKey("OrganizationID");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Remotely.Server.Migrations
{
public partial class DeviceAgentVersion : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "AgentVersion",
table: "Devices",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AgentVersion",
table: "Devices");
}
}
}

View File

@ -9,27 +9,30 @@ using Remotely.Server.Data;
namespace Remotely.Server.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190703215422_ResetUrl")]
partial class ResetUrl
[Migration("20191211163438_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
.HasAnnotation("ProductVersion", "3.1.0");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.HasKey("Id");
@ -44,14 +47,18 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
@ -63,42 +70,57 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Discriminator")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.HasKey("Id");
@ -118,14 +140,18 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
@ -137,15 +163,19 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
@ -156,9 +186,11 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
@ -169,15 +201,19 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("Value");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
@ -187,25 +223,34 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("CommandMode");
b.Property<string>("CommandMode")
.HasColumnType("TEXT");
b.Property<string>("CommandResults");
b.Property<string>("CommandResults")
.HasColumnType("TEXT");
b.Property<string>("CommandText");
b.Property<string>("CommandText")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("PSCoreResults");
b.Property<string>("PSCoreResults")
.HasColumnType("TEXT");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderConnectionID")
.HasColumnType("TEXT");
b.Property<string>("SenderUserID");
b.Property<string>("SenderUserID")
.HasColumnType("TEXT");
b.Property<string>("TargetDeviceIDs");
b.Property<string>("TargetDeviceIDs")
.HasColumnType("TEXT");
b.Property<DateTime>("TimeStamp");
b.Property<DateTime>("TimeStamp")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -217,79 +262,116 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("CurrentUser");
b.Property<string>("AgentVersion")
.HasColumnType("TEXT");
b.Property<string>("DeviceName");
b.Property<string>("CurrentUser")
.HasColumnType("TEXT");
b.Property<string>("Drives");
b.Property<string>("DeviceGroupID")
.HasColumnType("TEXT");
b.Property<double>("FreeMemory");
b.Property<string>("DeviceName")
.HasColumnType("TEXT");
b.Property<double>("FreeStorage");
b.Property<string>("Drives")
.HasColumnType("TEXT");
b.Property<bool>("Is64Bit");
b.Property<double>("FreeMemory")
.HasColumnType("REAL");
b.Property<bool>("IsOnline");
b.Property<double>("FreeStorage")
.HasColumnType("REAL");
b.Property<DateTime>("LastOnline");
b.Property<bool>("Is64Bit")
.HasColumnType("INTEGER");
b.Property<int>("OSArchitecture");
b.Property<bool>("IsOnline")
.HasColumnType("INTEGER");
b.Property<string>("OSDescription");
b.Property<DateTime>("LastOnline")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<int>("OSArchitecture")
.HasColumnType("INTEGER");
b.Property<string>("Platform");
b.Property<string>("OSDescription")
.HasColumnType("TEXT");
b.Property<int>("ProcessorCount");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("ServerVerificationToken");
b.Property<string>("Platform")
.HasColumnType("TEXT");
b.Property<int>("ProcessorCount")
.HasColumnType("INTEGER");
b.Property<string>("ServerVerificationToken")
.HasColumnType("TEXT");
b.Property<string>("Tags")
.HasColumnType("TEXT")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalMemory")
.HasColumnType("REAL");
b.Property<double>("TotalStorage");
b.Property<double>("TotalStorage")
.HasColumnType("REAL");
b.HasKey("ID");
b.HasIndex("DeviceGroupID");
b.HasIndex("OrganizationID");
b.ToTable("Devices");
});
modelBuilder.Entity("Remotely.Shared.Models.DevicePermissionLink", b =>
modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("ID")
.HasColumnType("TEXT");
b.Property<string>("DeviceID");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(200);
b.HasKey("PermissionGroupID", "DeviceID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.HasIndex("DeviceID");
b.HasKey("ID");
b.ToTable("DevicePermissionLinks");
b.HasIndex("OrganizationID");
b.ToTable("DeviceGroups");
});
modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<int>("EventType");
b.Property<int>("EventType")
.HasColumnType("INTEGER");
b.Property<string>("Message");
b.Property<string>("Message")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("Source");
b.Property<string>("Source")
.HasColumnType("TEXT");
b.Property<string>("StackTrace");
b.Property<string>("StackTrace")
.HasColumnType("TEXT");
b.Property<DateTime>("TimeStamp");
b.Property<DateTime>("TimeStamp")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -301,17 +383,22 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<DateTime>("DateSent");
b.Property<DateTime>("DateSent")
.HasColumnType("TEXT");
b.Property<string>("InvitedUser");
b.Property<string>("InvitedUser")
.HasColumnType("TEXT");
b.Property<bool>("IsAdmin");
b.Property<bool>("IsAdmin")
.HasColumnType("INTEGER");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("ResetUrl");
b.Property<string>("ResetUrl")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -323,9 +410,10 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("OrganizationName")
.HasColumnType("TEXT")
.HasMaxLength(25);
b.HasKey("ID");
@ -333,37 +421,25 @@ namespace Remotely.Server.Migrations
b.ToTable("Organizations");
});
modelBuilder.Entity("Remotely.Shared.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("ContentType");
b.Property<string>("ContentType")
.HasColumnType("TEXT");
b.Property<byte[]>("FileContents");
b.Property<byte[]>("FileContents")
.HasColumnType("BLOB");
b.Property<string>("FileName");
b.Property<string>("FileName")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<DateTime>("Timestamp");
b.Property<DateTime>("Timestamp")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -372,79 +448,73 @@ namespace Remotely.Server.Migrations
b.ToTable("SharedFiles");
});
modelBuilder.Entity("Remotely.Shared.Models.UserPermissionLink", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("RemotelyUserID");
b.HasKey("PermissionGroupID", "RemotelyUserID");
b.HasIndex("RemotelyUserID");
b.ToTable("UserPermissionLinks");
});
modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<bool>("IsAdministrator");
b.Property<bool>("IsAdministrator")
.HasColumnType("INTEGER");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("UserOptions");
b.Property<string>("UserOptions")
.HasColumnType("TEXT");
b.HasIndex("OrganizationID");
b.ToTable("RemotelyUsers");
b.HasDiscriminator().HasValue("RemotelyUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Remotely.Shared.Models.CommandContext", b =>
@ -456,22 +526,20 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
{
b.HasOne("Remotely.Shared.Models.DeviceGroup", "DeviceGroup")
.WithMany("Devices")
.HasForeignKey("DeviceGroupID");
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("Devices")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.DevicePermissionLink", b =>
modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
{
b.HasOne("Remotely.Shared.Models.Device", "Device")
.WithMany("DevicePermissionLinks")
.HasForeignKey("DeviceID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("DevicePermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("DeviceGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
@ -488,13 +556,6 @@ namespace Remotely.Server.Migrations
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.PermissionGroup", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
@ -502,19 +563,6 @@ namespace Remotely.Server.Migrations
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.UserPermissionLink", b =>
{
b.HasOne("Remotely.Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("UserPermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.RemotelyUser", "RemotelyUser")
.WithMany("UserPermissionLinks")
.HasForeignKey("RemotelyUserID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")

View File

@ -81,33 +81,18 @@ namespace Remotely.Server.Migrations
});
migrationBuilder.CreateTable(
name: "Devices",
name: "DeviceGroups",
columns: table => new
{
ID = table.Column<string>(nullable: false),
CurrentUser = table.Column<string>(nullable: true),
Drives = table.Column<string>(nullable: true),
FreeMemory = table.Column<double>(nullable: false),
FreeStorage = table.Column<double>(nullable: false),
Is64Bit = table.Column<bool>(nullable: false),
IsOnline = table.Column<bool>(nullable: false),
LastOnline = table.Column<DateTime>(nullable: false),
DeviceName = table.Column<string>(nullable: true),
OrganizationID = table.Column<string>(nullable: true),
OSArchitecture = table.Column<int>(nullable: false),
OSDescription = table.Column<string>(nullable: true),
Platform = table.Column<string>(nullable: true),
ProcessorCount = table.Column<int>(nullable: false),
ServerVerificationToken = table.Column<string>(nullable: true),
Tags = table.Column<string>(maxLength: 200, nullable: true),
TotalMemory = table.Column<double>(nullable: false),
TotalStorage = table.Column<double>(nullable: false)
Name = table.Column<string>(maxLength: 200, nullable: true),
OrganizationID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Devices", x => x.ID);
table.PrimaryKey("PK_DeviceGroups", x => x.ID);
table.ForeignKey(
name: "FK_Devices_Organizations_OrganizationID",
name: "FK_DeviceGroups_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
@ -145,7 +130,8 @@ namespace Remotely.Server.Migrations
InvitedUser = table.Column<string>(nullable: true),
IsAdmin = table.Column<bool>(nullable: false),
DateSent = table.Column<DateTime>(nullable: false),
OrganizationID = table.Column<string>(nullable: true)
OrganizationID = table.Column<string>(nullable: true),
ResetUrl = table.Column<string>(nullable: true)
},
constraints: table =>
{
@ -158,25 +144,6 @@ namespace Remotely.Server.Migrations
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "PermissionGroups",
columns: table => new
{
ID = table.Column<string>(nullable: false),
Name = table.Column<string>(maxLength: 100, nullable: true),
OrganizationID = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PermissionGroups", x => x.ID);
table.ForeignKey(
name: "FK_PermissionGroups_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RemotelyUsers",
columns: table => new
@ -235,27 +202,45 @@ namespace Remotely.Server.Migrations
});
migrationBuilder.CreateTable(
name: "DevicePermissionLinks",
name: "Devices",
columns: table => new
{
DeviceID = table.Column<string>(nullable: false),
PermissionGroupID = table.Column<string>(nullable: false)
ID = table.Column<string>(nullable: false),
AgentVersion = table.Column<string>(nullable: true),
CurrentUser = table.Column<string>(nullable: true),
DeviceName = table.Column<string>(nullable: true),
DeviceGroupID = table.Column<string>(nullable: true),
Drives = table.Column<string>(nullable: true),
FreeMemory = table.Column<double>(nullable: false),
FreeStorage = table.Column<double>(nullable: false),
Is64Bit = table.Column<bool>(nullable: false),
IsOnline = table.Column<bool>(nullable: false),
LastOnline = table.Column<DateTime>(nullable: false),
OrganizationID = table.Column<string>(nullable: true),
OSArchitecture = table.Column<int>(nullable: false),
OSDescription = table.Column<string>(nullable: true),
Platform = table.Column<string>(nullable: true),
ProcessorCount = table.Column<int>(nullable: false),
ServerVerificationToken = table.Column<string>(nullable: true),
Tags = table.Column<string>(maxLength: 200, nullable: true),
TotalMemory = table.Column<double>(nullable: false),
TotalStorage = table.Column<double>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DevicePermissionLinks", x => new { x.PermissionGroupID, x.DeviceID });
table.PrimaryKey("PK_Devices", x => x.ID);
table.ForeignKey(
name: "FK_DevicePermissionLinks_Devices_DeviceID",
column: x => x.DeviceID,
principalTable: "Devices",
name: "FK_Devices_DeviceGroups_DeviceGroupID",
column: x => x.DeviceGroupID,
principalTable: "DeviceGroups",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DevicePermissionLinks_PermissionGroups_PermissionGroupID",
column: x => x.PermissionGroupID,
principalTable: "PermissionGroups",
name: "FK_Devices_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
@ -343,30 +328,6 @@ namespace Remotely.Server.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserPermissionLinks",
columns: table => new
{
RemotelyUserID = table.Column<string>(nullable: false),
PermissionGroupID = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserPermissionLinks", x => new { x.PermissionGroupID, x.RemotelyUserID });
table.ForeignKey(
name: "FK_UserPermissionLinks_PermissionGroups_PermissionGroupID",
column: x => x.PermissionGroupID,
principalTable: "PermissionGroups",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserPermissionLinks_RemotelyUsers_RemotelyUserID",
column: x => x.RemotelyUserID,
principalTable: "RemotelyUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
@ -399,9 +360,14 @@ namespace Remotely.Server.Migrations
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_DevicePermissionLinks_DeviceID",
table: "DevicePermissionLinks",
column: "DeviceID");
name: "IX_DeviceGroups_OrganizationID",
table: "DeviceGroups",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_Devices_DeviceGroupID",
table: "Devices",
column: "DeviceGroupID");
migrationBuilder.CreateIndex(
name: "IX_Devices_OrganizationID",
@ -418,11 +384,6 @@ namespace Remotely.Server.Migrations
table: "InviteLinks",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_PermissionGroups_OrganizationID",
table: "PermissionGroups",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "RemotelyUsers",
@ -443,11 +404,6 @@ namespace Remotely.Server.Migrations
name: "IX_SharedFiles_OrganizationID",
table: "SharedFiles",
column: "OrganizationID");
migrationBuilder.CreateIndex(
name: "IX_UserPermissionLinks_RemotelyUserID",
table: "UserPermissionLinks",
column: "RemotelyUserID");
}
protected override void Down(MigrationBuilder migrationBuilder)
@ -471,7 +427,7 @@ namespace Remotely.Server.Migrations
name: "CommandContexts");
migrationBuilder.DropTable(
name: "DevicePermissionLinks");
name: "Devices");
migrationBuilder.DropTable(
name: "EventLogs");
@ -482,21 +438,15 @@ namespace Remotely.Server.Migrations
migrationBuilder.DropTable(
name: "SharedFiles");
migrationBuilder.DropTable(
name: "UserPermissionLinks");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "Devices");
migrationBuilder.DropTable(
name: "PermissionGroups");
migrationBuilder.DropTable(
name: "RemotelyUsers");
migrationBuilder.DropTable(
name: "DeviceGroups");
migrationBuilder.DropTable(
name: "Organizations");
}

View File

@ -14,20 +14,23 @@ namespace Remotely.Server.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
.HasAnnotation("ProductVersion", "3.1.0");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.HasKey("Id");
@ -42,14 +45,18 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
@ -61,42 +68,57 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Discriminator")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.HasKey("Id");
@ -116,14 +138,18 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
@ -135,15 +161,19 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired();
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
@ -154,9 +184,11 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
@ -167,15 +199,19 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("Value");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
@ -185,25 +221,34 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.CommandContext", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("CommandMode");
b.Property<string>("CommandMode")
.HasColumnType("TEXT");
b.Property<string>("CommandResults");
b.Property<string>("CommandResults")
.HasColumnType("TEXT");
b.Property<string>("CommandText");
b.Property<string>("CommandText")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("PSCoreResults");
b.Property<string>("PSCoreResults")
.HasColumnType("TEXT");
b.Property<string>("SenderConnectionID");
b.Property<string>("SenderConnectionID")
.HasColumnType("TEXT");
b.Property<string>("SenderUserID");
b.Property<string>("SenderUserID")
.HasColumnType("TEXT");
b.Property<string>("TargetDeviceIDs");
b.Property<string>("TargetDeviceIDs")
.HasColumnType("TEXT");
b.Property<DateTime>("TimeStamp");
b.Property<DateTime>("TimeStamp")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -215,81 +260,116 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("AgentVersion");
b.Property<string>("AgentVersion")
.HasColumnType("TEXT");
b.Property<string>("CurrentUser");
b.Property<string>("CurrentUser")
.HasColumnType("TEXT");
b.Property<string>("DeviceName");
b.Property<string>("DeviceGroupID")
.HasColumnType("TEXT");
b.Property<string>("Drives");
b.Property<string>("DeviceName")
.HasColumnType("TEXT");
b.Property<double>("FreeMemory");
b.Property<string>("Drives")
.HasColumnType("TEXT");
b.Property<double>("FreeStorage");
b.Property<double>("FreeMemory")
.HasColumnType("REAL");
b.Property<bool>("Is64Bit");
b.Property<double>("FreeStorage")
.HasColumnType("REAL");
b.Property<bool>("IsOnline");
b.Property<bool>("Is64Bit")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastOnline");
b.Property<bool>("IsOnline")
.HasColumnType("INTEGER");
b.Property<int>("OSArchitecture");
b.Property<DateTime>("LastOnline")
.HasColumnType("TEXT");
b.Property<string>("OSDescription");
b.Property<int>("OSArchitecture")
.HasColumnType("INTEGER");
b.Property<string>("OrganizationID");
b.Property<string>("OSDescription")
.HasColumnType("TEXT");
b.Property<string>("Platform");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<int>("ProcessorCount");
b.Property<string>("Platform")
.HasColumnType("TEXT");
b.Property<string>("ServerVerificationToken");
b.Property<int>("ProcessorCount")
.HasColumnType("INTEGER");
b.Property<string>("ServerVerificationToken")
.HasColumnType("TEXT");
b.Property<string>("Tags")
.HasColumnType("TEXT")
.HasMaxLength(200);
b.Property<double>("TotalMemory");
b.Property<double>("TotalMemory")
.HasColumnType("REAL");
b.Property<double>("TotalStorage");
b.Property<double>("TotalStorage")
.HasColumnType("REAL");
b.HasKey("ID");
b.HasIndex("DeviceGroupID");
b.HasIndex("OrganizationID");
b.ToTable("Devices");
});
modelBuilder.Entity("Remotely.Shared.Models.DevicePermissionLink", b =>
modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("ID")
.HasColumnType("TEXT");
b.Property<string>("DeviceID");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(200);
b.HasKey("PermissionGroupID", "DeviceID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.HasIndex("DeviceID");
b.HasKey("ID");
b.ToTable("DevicePermissionLinks");
b.HasIndex("OrganizationID");
b.ToTable("DeviceGroups");
});
modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<int>("EventType");
b.Property<int>("EventType")
.HasColumnType("INTEGER");
b.Property<string>("Message");
b.Property<string>("Message")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("Source");
b.Property<string>("Source")
.HasColumnType("TEXT");
b.Property<string>("StackTrace");
b.Property<string>("StackTrace")
.HasColumnType("TEXT");
b.Property<DateTime>("TimeStamp");
b.Property<DateTime>("TimeStamp")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -301,17 +381,22 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<DateTime>("DateSent");
b.Property<DateTime>("DateSent")
.HasColumnType("TEXT");
b.Property<string>("InvitedUser");
b.Property<string>("InvitedUser")
.HasColumnType("TEXT");
b.Property<bool>("IsAdmin");
b.Property<bool>("IsAdmin")
.HasColumnType("INTEGER");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("ResetUrl");
b.Property<string>("ResetUrl")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -323,9 +408,10 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.Organization", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("OrganizationName")
.HasColumnType("TEXT")
.HasMaxLength(25);
b.HasKey("ID");
@ -333,37 +419,25 @@ namespace Remotely.Server.Migrations
b.ToTable("Organizations");
});
modelBuilder.Entity("Remotely.Shared.Models.PermissionGroup", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.HasMaxLength(100);
b.Property<string>("OrganizationID");
b.HasKey("ID");
b.HasIndex("OrganizationID");
b.ToTable("PermissionGroups");
});
modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd();
.HasColumnType("TEXT");
b.Property<string>("ContentType");
b.Property<string>("ContentType")
.HasColumnType("TEXT");
b.Property<byte[]>("FileContents");
b.Property<byte[]>("FileContents")
.HasColumnType("BLOB");
b.Property<string>("FileName");
b.Property<string>("FileName")
.HasColumnType("TEXT");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<DateTime>("Timestamp");
b.Property<DateTime>("Timestamp")
.HasColumnType("TEXT");
b.HasKey("ID");
@ -372,79 +446,73 @@ namespace Remotely.Server.Migrations
b.ToTable("SharedFiles");
});
modelBuilder.Entity("Remotely.Shared.Models.UserPermissionLink", b =>
{
b.Property<string>("PermissionGroupID");
b.Property<string>("RemotelyUserID");
b.HasKey("PermissionGroupID", "RemotelyUserID");
b.HasIndex("RemotelyUserID");
b.ToTable("UserPermissionLinks");
});
modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<bool>("IsAdministrator");
b.Property<bool>("IsAdministrator")
.HasColumnType("INTEGER");
b.Property<string>("OrganizationID");
b.Property<string>("OrganizationID")
.HasColumnType("TEXT");
b.Property<string>("UserOptions");
b.Property<string>("UserOptions")
.HasColumnType("TEXT");
b.HasIndex("OrganizationID");
b.ToTable("RemotelyUsers");
b.HasDiscriminator().HasValue("RemotelyUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Remotely.Shared.Models.CommandContext", b =>
@ -456,22 +524,20 @@ namespace Remotely.Server.Migrations
modelBuilder.Entity("Remotely.Shared.Models.Device", b =>
{
b.HasOne("Remotely.Shared.Models.DeviceGroup", "DeviceGroup")
.WithMany("Devices")
.HasForeignKey("DeviceGroupID");
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("Devices")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.DevicePermissionLink", b =>
modelBuilder.Entity("Remotely.Shared.Models.DeviceGroup", b =>
{
b.HasOne("Remotely.Shared.Models.Device", "Device")
.WithMany("DevicePermissionLinks")
.HasForeignKey("DeviceID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("DevicePermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("DeviceGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
@ -488,13 +554,6 @@ namespace Remotely.Server.Migrations
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.PermissionGroup", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("PermissionGroups")
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.SharedFile", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
@ -502,19 +561,6 @@ namespace Remotely.Server.Migrations
.HasForeignKey("OrganizationID");
});
modelBuilder.Entity("Remotely.Shared.Models.UserPermissionLink", b =>
{
b.HasOne("Remotely.Shared.Models.PermissionGroup", "PermissionGroup")
.WithMany("UserPermissionLinks")
.HasForeignKey("PermissionGroupID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Remotely.Shared.Models.RemotelyUser", "RemotelyUser")
.WithMany("UserPermissionLinks")
.HasForeignKey("RemotelyUserID")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Remotely.Shared.Models.RemotelyUser", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")

BIN
Server/Server.db-shm Normal file

Binary file not shown.

BIN
Server/Server.db-wal Normal file

Binary file not shown.

View File

@ -48,18 +48,7 @@ namespace Remotely.Server.Services
}
}
private SignInManager<RemotelyUser> SignInManager { get; }
public async Task AddGroup(string[] deviceIDs, string groupName)
{
groupName = groupName.Trim();
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
if (!DataService.DoesGroupExist(RemotelyUser.Id, groupName))
{
await Clients.Caller.SendAsync("DisplayMessage", "Permission group does not exist.", "Permission group does not exist.");
return;
}
DataService.AddPermissionToDevices(RemotelyUser.Id, deviceIDs, groupName);
await Clients.Caller.SendAsync("DisplayMessage", "Group added.");
}
public async Task DeployScript(string fileID, string mode, string[] deviceIDs)
{
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
@ -103,15 +92,10 @@ namespace Remotely.Server.Services
}
}
public async Task GetGroups(string[] deviceIDs)
{
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
var result = DataService.GetDevicesAndPermissions(RemotelyUser.Id, deviceIDs);
await Clients.Caller.SendAsync("GetGroupsResult", result);
}
public override async Task OnConnectedAsync()
{
RemotelyUser = DataService.GetUserAndPermissionsByID(Context.UserIdentifier);
RemotelyUser = DataService.GetUserByID(Context.UserIdentifier);
if (await IsConnectionValid() == false)
{
return;
@ -151,18 +135,7 @@ namespace Remotely.Server.Services
await Clients.Caller.SendAsync("RefreshDeviceList");
}
public async Task RemoveGroup(string[] deviceIDs, string groupName)
{
groupName = groupName.Trim();
deviceIDs = DataService.FilterDeviceIDsByUserPermission(deviceIDs, RemotelyUser);
if (!DataService.DoesGroupExist(RemotelyUser.Id, groupName))
{
await Clients.Caller.SendAsync("DisplayMessage", "Permission group does not exist.");
return;
}
DataService.RemovePermissionFromDevices(RemotelyUser.Id, deviceIDs, groupName);
await Clients.Caller.SendAsync("DisplayMessage", "Group removed.", "Group removed.");
}
public async Task TransferFiles(List<string> fileIDs, string transferID, string[] deviceIDs)
{
DataService.WriteEvent(new EventLog()

View File

@ -11,27 +11,7 @@ import { GetSelectedDevices } from "../DataGrid.js";
var commands: Array<ConsoleCommand> = [
new ConsoleCommand(
"AddGroup",
[
new Parameter("group", "The group name to add.", "String")
],
"Adds a permission group to the selected computer(s).",
"AddGroup -group Lab Devices",
"",
(parameters, paramDictionary) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
};
if (!paramDictionary["group"]) {
AddConsoleOutput("A group name is required.");
return;
}
BrowserSockets.Connection.invoke("AddGroup", selectedDevices.map(x=>x.ID), paramDictionary["group"]);
}
),
new ConsoleCommand(
"DeployScript",
[
@ -66,22 +46,6 @@ var commands: Array<ConsoleCommand> = [
fileInput.click();
}
),
new ConsoleCommand(
"GetGroups",
[
],
"Lists the permission group(s) that are applied to the selected computer(s).",
"GetGroups",
"",
(parameters, paramDictionary) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
};
BrowserSockets.Connection.invoke("GetGroups", selectedDevices.map(x=>x.ID));
}
),
new ConsoleCommand(
"GetVersion",
[
@ -114,27 +78,6 @@ var commands: Array<ConsoleCommand> = [
UI.AddConsoleOutput(output);
}
),
new ConsoleCommand(
"RemoveGroup",
[
new Parameter("group", "The group name to remove.", "String")
],
"Removes a permission group to the selected computer(s).",
"RemoveGroup -group Lab Devices",
"",
(parameters, paramDictionary) => {
var selectedDevices = Main.DataGrid.GetSelectedDevices();
if (selectedDevices.length == 0) {
AddConsoleOutput("No devices are selected.");
return;
};
if (!paramDictionary["group"]) {
AddConsoleOutput("A group name is required.");
return;
}
BrowserSockets.Connection.invoke("RemoveGroup", selectedDevices.map(x => x.ID), paramDictionary["group"]);
}
),
new ConsoleCommand(
"Clear",
[

View File

@ -1,22 +1,9 @@
import { ShowModal, ValidateInput, PopupMessage } from "../UI.js";
document.getElementById("permissionHelpButton").addEventListener("click", (ev) => {
ShowModal("Permissions", `Permission groups can be used to restrict access to computers.<br><br>
A computer with no permission groups will be accessible by anyone. If permissions groups
are applied, only users with one or more matching groups can access it.
<br><br>
All permission groups for the organization are managed in this list.`);
});
document.getElementById("usersHelpButton").addEventListener("click", (ev) => {
ShowModal("Users", `All users for the organization are managed here.<br><br>
Administrators will have access to this management screen as well as all computers.
<br><br>
Users with no permission groups will only have access to computers that also have
no permission groups.
<br><br>
Users with permission groups will also have access to computers with the same
permission group.`);
Administrators will have access to this management screen as well as all computers.`);
});
document.getElementById("invitesHelpButton").addEventListener("click", (ev) => {
ShowModal("Invitations", `All pending invitations will be shown here and can be revoked by deleting them.<br><br>
@ -55,125 +42,7 @@ document.getElementById("organizationNameInput").addEventListener("blur", (ev) =
xhr.send(JSON.stringify((ev.currentTarget as HTMLInputElement).value));
});
document.getElementById("removePermissionButton").addEventListener("click", (ev) => {
var selectList = document.getElementById("permissionList") as HTMLSelectElement;
for (var i = 0; i < selectList.selectedOptions.length; i++) {
let selectedValue = selectList.selectedOptions[i].value;
let xhr = new XMLHttpRequest();
xhr.onload = (ev) => {
console.log(ev.srcElement);
if (xhr.status == 200) {
document.querySelectorAll(`.all-permissions-list option[value='${selectedValue}']`).forEach(option => {
option.remove();
})
document.querySelectorAll(`.user-permissions-list option[value='${selectedValue}']`).forEach(option => {
option.remove();
})
}
else if (xhr.status == 400) {
ShowModal("Invalid Request", xhr.responseText);
}
else {
showError(xhr);
}
}
xhr.onerror = () => {
showError(xhr);
}
xhr.open("delete", location.origin + "/api/OrganizationManagement/Permission");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify(selectedValue));
}
});
document.getElementById("permissionInput").addEventListener("keypress", (e) => {
if (e.key.toLowerCase() == "enter") {
document.getElementById("addPermissionButton").click();
}
})
document.getElementById("addPermissionButton").addEventListener("click", () => {
var input = document.getElementById("permissionInput") as HTMLInputElement;
if (input.checkValidity() && input.value.length > 0) {
var xhr = new XMLHttpRequest();
xhr.onload = () => {
if (xhr.status == 200) {
document.querySelectorAll(`.all-permissions-list`).forEach((list: HTMLSelectElement) => {
var newOption = new Option(input.value, xhr.responseText);
list.options.add(newOption);
})
input.value = "";
}
else if (xhr.status == 400) {
ShowModal("Invalid Request", xhr.responseText);
}
else {
showError(xhr);
}
}
xhr.onerror = () => {
showError(xhr);
}
xhr.open("post", location.origin + "/api/OrganizationManagement/Permission");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify({ Name: input.value }));
}
})
document.querySelectorAll(".remove-permission-from-user-button").forEach((removeButton: HTMLButtonElement) => {
removeButton.addEventListener("click", (ev) => {
var userID = removeButton.getAttribute("user");
var userPermissionList = document.querySelector(`div.modal[user='${userID}'] .user-permissions-list`) as HTMLSelectElement;
for (var i = 0; i < userPermissionList.selectedOptions.length; i++) {
let selectedValue = userPermissionList.selectedOptions[i].value;
let xhr = new XMLHttpRequest();
xhr.onload = () => {
if (xhr.status == 200) {
userPermissionList.querySelector(`option[value='${selectedValue}']`).remove();
}
else if (xhr.status == 400) {
ShowModal("Invalid Request", xhr.responseText);
}
else {
showError(xhr);
}
}
xhr.onerror = () => {
showError(xhr);
}
xhr.open("delete", `${location.origin}/api/OrganizationManagement/RemovePermissionFromUser/${userID}/${selectedValue}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send();
}
})
})
document.querySelectorAll(".add-permission-to-user-button").forEach((addButton: HTMLButtonElement) => {
addButton.addEventListener("click", (ev) => {
var userID = addButton.getAttribute("user");
var userPermissionList = document.querySelector(`div.modal[user='${userID}'] .user-permissions-list`) as HTMLSelectElement;
var allPermissionsList = document.querySelector(`div.modal[user='${userID}'] .all-permissions-list`) as HTMLSelectElement;
var xhr = new XMLHttpRequest();
xhr.onload = () => {
if (xhr.status == 200) {
var newOption = new Option(allPermissionsList.selectedOptions[0].text, allPermissionsList.selectedOptions[0].value);
userPermissionList.options.add(newOption);
}
else if (xhr.status == 400) {
ShowModal("Invalid Request", xhr.responseText);
}
else {
showError(xhr);
}
}
xhr.onerror = () => {
showError(xhr);
}
xhr.open("post", location.origin + `/api/OrganizationManagement/AddUserPermission/${userID}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify(allPermissionsList.selectedOptions[0].value));
})
})
document.querySelectorAll(".user-is-admin-checkbox").forEach((checkbox: HTMLInputElement) => {
checkbox.addEventListener("change", (ev) => {
var userID = checkbox.getAttribute("user");

View File

@ -17,8 +17,8 @@ namespace Remotely.Shared.Models
public string CurrentUser { get; set; }
public string DeviceName { get; set; }
[JsonIgnore]
public virtual ICollection<DevicePermissionLink> DevicePermissionLinks { get; set; } = new List<DevicePermissionLink>();
public virtual DeviceGroup DeviceGroup { get; set; }
public List<Drive> Drives { get; set; }
public double FreeMemory { get; set; }
@ -33,6 +33,7 @@ namespace Remotely.Shared.Models
public bool IsOnline { get; set; }
public DateTime LastOnline { get; set; }
[JsonIgnore]
public virtual Organization Organization { get; set; }
public string OrganizationID { get; set; }
public Architecture OSArchitecture { get; set; }
@ -88,7 +89,7 @@ namespace Remotely.Shared.Models
VolumeLabel = x.VolumeLabel
}).ToList(),
OrganizationID = connectionInfo.OrganizationID,
CurrentUser = GetCurrentUser()
CurrentUser = DeviceInformation.GetCurrentUser()
};
if (systemDrive != null && systemDrive.TotalSize > 0 && systemDrive.TotalFreeSpace > 0)
@ -102,11 +103,11 @@ namespace Remotely.Shared.Models
if (OSUtils.IsWindows)
{
totalMemory = GetWinMemoryInGB();
totalMemory = DeviceInformation.GetWinMemoryInGB();
}
else if (OSUtils.IsLinux)
{
totalMemory = GetLinxMemoryInGB();
totalMemory = DeviceInformation.GetLinxMemoryInGB();
}
if (totalMemory.Item2 > 0)
@ -127,82 +128,5 @@ namespace Remotely.Shared.Models
return device;
}
private static string GetCurrentUser()
{
try
{
if (OSUtils.IsWindows)
{
var session = CimSession.Create(null);
var computerSystem = session.EnumerateInstances("root\\cimv2", "CIM_ComputerSystem");
var username = computerSystem.FirstOrDefault().CimInstanceProperties["UserName"].Value ?? "";
return username as string;
}
else if (OSUtils.IsLinux)
{
var users = OSUtils.StartProcessWithResults("users", "");
var username = users?.Split()?.FirstOrDefault()?.Trim();
return $"{Environment.UserDomainName}\\{username}";
}
throw new Exception("Unsupported operating system.");
}
catch
{
return "Error Retrieving";
}
}
private static Tuple<double, double> GetLinxMemoryInGB()
{
try
{
var results = OSUtils.StartProcessWithResults("cat", "/proc/meminfo");
var resultsArr = results.Split('n');
var freeKB = resultsArr
.FirstOrDefault(x => x.StartsWith("FreeMem"))
.Split(" ".ToCharArray(), 2)
.Last() // 9168236 kB
.Trim()
.Split(' ')
.First(); // 9168236
var totalKB = resultsArr
.FirstOrDefault(x => x.StartsWith("MemTotal"))
.Split(" ".ToCharArray(), 2)
.Last() // 16637468 kB
.Trim()
.Split(' ')
.First(); // 16637468
var freeGB = Math.Round((double.Parse(freeKB) / 1024 / 1024), 2);
var totalGB = Math.Round((double.Parse(totalKB) / 1024 / 1024), 2);
return new Tuple<double, double>(freeGB, totalGB);
}
catch
{
return new Tuple<double, double>(0, 0);
}
}
private static Tuple<double, double> GetWinMemoryInGB()
{
try
{
var session = CimSession.Create(null);
var cimOS = session.EnumerateInstances("root\\cimv2", "CIM_OperatingSystem");
var free = (ulong)(cimOS.FirstOrDefault()?.CimInstanceProperties["FreePhysicalMemory"]?.Value ?? 0);
var freeGB = Math.Round(((double)free / 1024 / 1024), 2);
var total = (ulong)(cimOS.FirstOrDefault()?.CimInstanceProperties["TotalVisibleMemorySize"]?.Value ?? 0);
var totalGB = Math.Round(((double)total / 1024 / 1024), 2);
return new Tuple<double, double>(freeGB, totalGB);
}
catch
{
return new Tuple<double, double>(0, 0);
}
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models
{
public class DeviceGroup
{
[StringLength(200)]
public string Name { get; set; }
[Key]
public string ID { get; set; }
public virtual List<Device> Devices { get; set; }
[JsonIgnore]
public Organization Organization { get; set; }
public string OrganizationID { get; set; }
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Remotely.Shared.Models
{
public class DevicePermissionLink
{
public string DeviceID { get; set; }
public Device Device { get; set; }
public string PermissionGroupID { get; set; }
public PermissionGroup PermissionGroup { get; set; }
}
}

View File

@ -16,7 +16,7 @@ namespace Remotely.Shared.Models
public virtual ICollection<Device> Devices { get; set; }
public virtual ICollection<CommandContext> CommandContexts { get; set; }
public virtual ICollection<EventLog> EventLogs { get; set; }
public virtual ICollection<PermissionGroup> PermissionGroups { get; set; } = new List<PermissionGroup>();
public virtual ICollection<DeviceGroup> DeviceGroups { get; set; }
public virtual ICollection<InviteLink> InviteLinks { get; set; }
public virtual ICollection<SharedFile> SharedFiles { get; set; }
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Remotely.Shared.Models
{
public class PermissionGroup
{
[Key]
public string ID { get; set; } = Guid.NewGuid().ToString();
[StringLength(100)]
public string Name { get; set; }
public virtual Organization Organization { get; set; }
public virtual ICollection<UserPermissionLink> UserPermissionLinks { get; set; } = new List<UserPermissionLink>();
public virtual ICollection<DevicePermissionLink> DevicePermissionLinks { get; set; } = new List<DevicePermissionLink>();
}
}

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Remotely.Shared.Models
@ -16,11 +17,10 @@ namespace Remotely.Shared.Models
}
public RemotelyUserOptions UserOptions { get; set; }
[JsonIgnore]
public virtual Organization Organization { get; set; }
public string OrganizationID { get; set; }
public virtual ICollection<UserPermissionLink> UserPermissionLinks { get; set; } = new List<UserPermissionLink>();
public bool IsAdministrator { get; set; } = true;
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Remotely.Shared.Models
{
public class UserPermissionLink
{
public string RemotelyUserID { get; set; }
public RemotelyUser RemotelyUser { get; set; }
public string PermissionGroupID { get; set; }
public PermissionGroup PermissionGroup { get; set; }
}
}

View File

@ -0,0 +1,89 @@
using Microsoft.Management.Infrastructure;
using Remotely.Shared.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Remotely.Shared.Services
{
public class DeviceInformation
{
public static string GetCurrentUser()
{
try
{
if (OSUtils.IsWindows)
{
var session = CimSession.Create(null);
var computerSystem = session.EnumerateInstances("root\\cimv2", "CIM_ComputerSystem");
var username = computerSystem.FirstOrDefault().CimInstanceProperties["UserName"].Value ?? "";
return username as string;
}
else if (OSUtils.IsLinux)
{
var users = OSUtils.StartProcessWithResults("users", "");
var username = users?.Split()?.FirstOrDefault()?.Trim();
return $"{Environment.UserDomainName}\\{username}";
}
throw new Exception("Unsupported operating system.");
}
catch
{
return "Error Retrieving";
}
}
public static Tuple<double, double> GetLinxMemoryInGB()
{
try
{
var results = OSUtils.StartProcessWithResults("cat", "/proc/meminfo");
var resultsArr = results.Split('n');
var freeKB = resultsArr
.FirstOrDefault(x => x.StartsWith("FreeMem"))
.Split(" ".ToCharArray(), 2)
.Last() // 9168236 kB
.Trim()
.Split(' ')
.First(); // 9168236
var totalKB = resultsArr
.FirstOrDefault(x => x.StartsWith("MemTotal"))
.Split(" ".ToCharArray(), 2)
.Last() // 16637468 kB
.Trim()
.Split(' ')
.First(); // 16637468
var freeGB = Math.Round((double.Parse(freeKB) / 1024 / 1024), 2);
var totalGB = Math.Round((double.Parse(totalKB) / 1024 / 1024), 2);
return new Tuple<double, double>(freeGB, totalGB);
}
catch
{
return new Tuple<double, double>(0, 0);
}
}
public static Tuple<double, double> GetWinMemoryInGB()
{
try
{
var session = CimSession.Create(null);
var cimOS = session.EnumerateInstances("root\\cimv2", "CIM_OperatingSystem");
var free = (ulong)(cimOS.FirstOrDefault()?.CimInstanceProperties["FreePhysicalMemory"]?.Value ?? 0);
var freeGB = Math.Round(((double)free / 1024 / 1024), 2);
var total = (ulong)(cimOS.FirstOrDefault()?.CimInstanceProperties["TotalVisibleMemorySize"]?.Value ?? 0);
var totalGB = Math.Round(((double)total / 1024 / 1024), 2);
return new Tuple<double, double>(freeGB, totalGB);
}
catch
{
return new Tuple<double, double>(0, 0);
}
}
}
}

View File

@ -24,9 +24,6 @@
<Compile Update="Models\Device.cs">
<Generator></Generator>
</Compile>
<Compile Update="Models\DevicePermissionLink.cs">
<Generator></Generator>
</Compile>
<Compile Update="Models\GenericCommandResult.cs">
<LastGenOutput>GenericCommandResult.cs.d.ts</LastGenOutput>
<Generator>DtsGenerator</Generator>

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Remotely.Shared.ViewModels.Organization
{
public class Invite
{
public string ID { get; set; }
public bool IsAdmin { get; set; }
public DateTime DateSent { get; set; }
public string InvitedUser { get; set; }
public string ResetUrl { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Remotely.Shared.ViewModels.Organization
{
public class OrganizationUser
{
public string ID { get; set; }
public string UserName { get; set; }
public bool IsAdmin { get; set; }
}
}

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Remotely.Shared.ViewModels
{
public class Permission
{
public string ID { get; set; }
[StringLength(100)]
public string Name { get; set; }
}
public class OrganizationUser
{
public string ID { get; set; }
public string UserName { get; set; }
public bool IsAdmin { get; set; }
public List<Permission> Permissions { get; set; }
}
public class Invite
{
public string ID { get; set; }
public bool IsAdmin { get; set; }
public DateTime DateSent { get; set; }
public string InvitedUser { get; set; }
public string ResetUrl { get; set; }
}
}