internal async Task <AppRole> Role(App app, AppRoleName roleName) { var record = await rolesForApp(app) .Where(r => r.Name == roleName.Value) .FirstOrDefaultAsync(); return(factory.Role(record)); }
public async Task <IAppRole> Role(AppRoleName roleName) { var modifier = await appContext.GetModifierKey(); var role = await hubClient.App.GetRole(modifier, roleName.Value); return(new HubClientRole(role)); }
internal async Task <AppRole> Add(App app, AppRoleName name) { var record = new AppRoleRecord { AppID = app.ID.Value, Name = name.Value }; await factory.DB.Roles.Create(record); return(factory.Role(record)); }
public async Task ShouldAddRoles() { var input = setup(); await execute(input); var app = await input.Factory.Apps().App(input.Options.AppKey); var roleNames = new[] { FakeInfo.Roles.Manager, FakeInfo.Roles.Viewer } .Union(AppRoleName.DefaultRoles()); var appRoles = await app.Roles(); Assert.That(appRoles.Select(r => r.Name()), Is.EquivalentTo(roleNames), "Should add role names from app role names"); }
public HubClientRole(AppRoleModel model) { ID = new EntityID(model.ID); name = new AppRoleName(model.Name); }