public static User User(int id = 0, string name = "Miku", UserGroupId group = UserGroupId.Regular, string email = "") { return(new User(name, "123", email, 0) { GroupId = group, Id = id }); }
public PartialFindResult <UserForApiContract> GetList( string query = "", UserGroupId groups = UserGroupId.Nothing, DateTime?joinDateAfter = null, DateTime?joinDateBefore = null, NameMatchMode nameMatchMode = NameMatchMode.Auto, int start = 0, int maxResults = 10, bool getTotalCount = false, UserSortRule?sort = null, bool includeDisabled = false, bool onlyVerified = false, string knowsLanguage = null, UserOptionalFields fields = UserOptionalFields.None) { var queryParams = new UserQueryParams { Common = new CommonSearchParams(SearchTextQuery.Create(query, nameMatchMode), false, false), Group = groups, IncludeDisabled = includeDisabled, OnlyVerifiedArtists = onlyVerified, KnowsLanguage = knowsLanguage, JoinDateAfter = joinDateAfter, JoinDateBefore = joinDateBefore, Sort = sort ?? UserSortRule.Name, Paging = new PagingProperties(start, maxResults, getTotalCount) }; return(queries.GetUsers(queryParams, user => new UserForApiContract(user, userIconFactory, fields))); }
public Index(PagingData<UserContract> users, UserGroupId groupId, string name, bool verifiedArtists) { Users = users; GroupId = groupId; Name = name; VerifiedArtists = verifiedArtists; }
public static User User(int id = 0, string name = "Miku", UserGroupId group = UserGroupId.Regular, string email = "") { return(new User(name, "123", email, PasswordHashAlgorithms.Default) { GroupId = group, Id = id }); }
public Index(PagingData <UserContract> users, UserGroupId groupId, string name, bool verifiedArtists) { Users = users; GroupId = groupId; Name = name; VerifiedArtists = verifiedArtists; }
public UserAddedToGroup(UserGroupId userGroupId, UserAccountId userAccountId, string userGroupName, string userName) { UserGroupId = userGroupId; UserAccountId = userAccountId; UserGroupName = userGroupName; UserName = userName; }
public VehicleAddedToUserGroup(UserGroupId userGroupId, VehicleId vehicleId, string licensePlateId, string?name) { UserGroupId = userGroupId; VehicleId = vehicleId; LicensePlateId = licensePlateId; Name = name; }
/// <summary> /// Gets a group by Id. /// </summary> /// <param name="groupId">Group Id.</param> /// <returns>User group matching the Id, or <see cref="Nothing"/>, if no matching group is found.</returns> public static UserGroup GetGroup(UserGroupId groupId) { if (!groups.ContainsKey(groupId)) return Nothing; return groups[groupId]; }
public static PermissionCollection GetPermissions(UserGroupId groupId) { if (!groups.ContainsKey(groupId)) return new PermissionCollection(); return groups[groupId].Permissions; }
public VehicleGroupChanged( VehicleId vehicleId, UserGroupId oldGroup, UserGroupId newGroup) { VehicleId = vehicleId; OldGroup = oldGroup; NewGroup = newGroup; }
public static PermissionCollection GetPermissions(UserGroupId groupId) { if (!groups.ContainsKey(groupId)) { return(new PermissionCollection()); } return(groups[groupId].Permissions); }
/// <summary> /// Gets a group by Id. /// </summary> /// <param name="groupId">Group Id.</param> /// <returns>User group matching the Id, or <see cref="Nothing"/>, if no matching group is found.</returns> public static UserGroup GetGroup(UserGroupId groupId) { if (!groups.ContainsKey(groupId)) { return(Nothing); } return(groups[groupId]); }
public Driver(DriverId id, string firstName, string lastName, string description, UserGroupId userGroupId, DriverGroup group) { Id = id; FirstName = firstName; LastName = lastName; Description = description; UserGroupId = userGroupId; Group = group; }
public VehicleGroupAddedToUserGroup( TenantId tenantId, VehicleGroupId vehicleGroupId, string vehicleGroupName, UserGroupId userGroupId, string userGroupName) { TenantId = tenantId; VehicleGroupId = vehicleGroupId; VehicleGroupName = vehicleGroupName; UserGroupId = userGroupId; UserGroupName = userGroupName; }
private PartialFindResult <UserContract> CallGetUsers(UserGroupId groupId = UserGroupId.Nothing, string name = null, bool disabled = false, bool verifiedArtists = false, UserSortRule sortRule = UserSortRule.Name, PagingProperties paging = null) { var queryParams = new UserQueryParams { Common = new CommonSearchParams(SearchTextQuery.Create(name), false, false), Group = groupId, IncludeDisabled = disabled, OnlyVerifiedArtists = verifiedArtists, Sort = sortRule, Paging = paging ?? new PagingProperties(0, 10, true) }; return(data.GetUsers(queryParams, u => new UserContract(u))); }
public AddVehicle( string licensePlateId, UserGroupId userGroupId, string?brand, string?model, string name, int?mileage, VehicleTypeId?vehicleTypeId, VehicleGroupId?vehicleGroupId) { LicensePlateId = licensePlateId; UserGroupId = userGroupId; Brand = brand; Model = model; Name = name; Mileage = mileage; VehicleTypeId = vehicleTypeId; VehicleGroupId = vehicleGroupId; }
public PartialFindResult <UserForApiContract> GetList( string query = "", UserGroupId groups = UserGroupId.Nothing, NameMatchMode nameMatchMode = NameMatchMode.Auto, int start = 0, int maxResults = 10, bool getTotalCount = false, UserSortRule?sort = null, bool includeDisabled = false, bool onlyVerified = false, string knowsLanguage = null, UserOptionalFields fields = UserOptionalFields.None) { return(queries.GetUsers(SearchTextQuery.Create(query, nameMatchMode), groups, includeDisabled, onlyVerified, knowsLanguage, sort ?? UserSortRule.Name, new PagingProperties(start, maxResults, getTotalCount), user => new UserForApiContract(user, userIconFactory, fields))); }
public ActionResult UsersPaged(UserGroupId groupId = UserGroupId.Nothing, string name = "", UserSortRule sortRule = UserSortRule.RegisterDate, int totalCount = 0, int page = 1) { var pageIndex = page - 1; var result = Service.GetUsers(groupId, name, sortRule, PagingProperties.CreateFromPage(pageIndex, usersPerPage, false)); var data = new PagingData <UserContract>(result.Items.ToPagedList(pageIndex, usersPerPage, totalCount), null, "Index", "usersList"); data.RouteValues = new RouteValueDictionary(new { groupId, sortRule, totalCount, action = "Index" }); if (Request.IsAjaxRequest()) { return(PartialView("PagedUsers", data)); } else { return(View("PagedUsers", data)); } }
public PartialFindResult <UserContract> GetUsers(UserGroupId groupId, string name, UserSortRule sortRule, PagingProperties paging) { return(HandleQuery(session => { var users = AddOrder(session.Query <User>() .Where(u => (groupId == UserGroupId.Nothing || u.GroupId == groupId) && string.IsNullOrWhiteSpace(name) || u.Name.Contains(name)), sortRule) .Skip(paging.Start) .Take(paging.MaxEntries) .ToArray() .Select(u => new UserContract(u)) .ToArray(); var count = paging.GetTotalCount ? session.Query <User>() .Count(u => (groupId == UserGroupId.Nothing || u.GroupId == groupId) && string.IsNullOrWhiteSpace(name) || u.Name.Contains(name)) : 0; return new PartialFindResult <UserContract>(users, count); })); }
public PartialFindResult <UserContract> GetUsers(UserGroupId groupId, string name, bool disabled, bool verifiedArtists, UserSortRule sortRule, PagingProperties paging) { return(repository.HandleQuery(ctx => { var usersQuery = ctx.Query(); if (groupId != UserGroupId.Nothing) { usersQuery = usersQuery.Where(u => u.GroupId == groupId); } if (!string.IsNullOrWhiteSpace(name)) { usersQuery = usersQuery.Where(u => u.Name.Contains(name)); } if (!disabled) { usersQuery = usersQuery.Where(u => u.Active); } if (verifiedArtists) { usersQuery = usersQuery.Where(u => u.AllOwnedArtists.Any()); } var users = AddOrder(usersQuery, sortRule) .Skip(paging.Start) .Take(paging.MaxEntries) .ToArray() .Select(u => new UserContract(u)) .ToArray(); var count = paging.GetTotalCount ? usersQuery.Count() : 0; return new PartialFindResult <UserContract>(users, count); })); }
public UserRemovedFromGroup(UserGroupId userGroupId, UserAccountId userAccountId) { UserGroupId = userGroupId; UserAccountId = userAccountId; }
public Index(PagingData<UserContract> users, UserGroupId groupId, string name) { Users = users; GroupId = groupId; Name = name; }
public Index(PagingData <UserContract> users, UserGroupId groupId, string name) { Users = users; GroupId = groupId; Name = name; }
public static User User(int id = 0, string name = "Miku", UserGroupId group = UserGroupId.Regular, string email = "") { return new User(name, "123", email, 0) { GroupId = group, Id = id }; }
public VehicleGroupRemovedFromUserGroup( VehicleGroupId vehicleGroupId, UserGroupId userGroupId) { VehicleGroupId = vehicleGroupId; UserGroupId = userGroupId; }
private PartialFindResult <UserContract> CallGetUsers(UserGroupId groupId = UserGroupId.Nothing, string name = null, bool disabled = false, bool verifiedArtists = false, UserSortRule sortRule = UserSortRule.Name, PagingProperties paging = null) { return(data.GetUsers(SearchTextQuery.Create(name), groupId, disabled, verifiedArtists, sortRule, paging ?? new PagingProperties(0, 10, true), u => new UserContract(u))); }
private void TestCanEdit(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular) { _artist.Status = entryStatus; _user.GroupId = userGroup; var result = EntryPermissionManager.CanEdit(new FakePermissionContext(_user), _artist); result.Should().Be(expected, "result"); }
private PartialFindResult<UserContract> CallGetUsers(UserGroupId groupId = UserGroupId.Nothing, string name = null, bool disabled = false, bool verifiedArtists = false, UserSortRule sortRule = UserSortRule.Name, PagingProperties paging = null) { return data.GetUsers(groupId, name, disabled, verifiedArtists, sortRule, paging ?? new PagingProperties(0, 10, true)); }
public UserGroup(UserGroupId id, PermissionCollection permissions) { this.Id = id; this.Permissions = permissions; }
public static bool CanEditGroupTo(IUserPermissionContext permissionContext, UserGroupId groupId) { ParamIs.NotNull(() => permissionContext); return(permissionContext.UserGroupId == UserGroupId.Admin || permissionContext.UserGroupId > groupId); }
public UserGroup(UserGroupId id, params PermissionToken[] permissions) { this.Id = id; this.Permissions = new PermissionCollection(permissions); }
public ActionResult UsersPaged(UserGroupId groupId = UserGroupId.Nothing, string name = "", UserSortRule sortRule = UserSortRule.RegisterDate, int totalCount = 0, int page = 1) { var pageIndex = page - 1; var result = Service.GetUsers(groupId, name, sortRule, PagingProperties.CreateFromPage(pageIndex, usersPerPage, false)); var data = new PagingData<UserContract>(result.Items.ToPagedList(pageIndex, usersPerPage, totalCount), null, "Index", "usersList"); data.RouteValues = new RouteValueDictionary(new { groupId, sortRule, totalCount, action = "Index" }); if (Request.IsAjaxRequest()) return PartialView("PagedUsers", data); else return View("PagedUsers", data); }
public GetVehicleInUserGroup(UserGroupId userGroupId) { UserGroupId = userGroupId; }
public VehicleInVehicleGroupQuery(UserGroupId userGroupId) { UserGroupId = userGroupId; }
private void TestCanDelete(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular) { _artist.Status = entryStatus; _user.GroupId = userGroup; var result = CanDelete(_user, _artist); result.Should().Be(expected, "result"); }
public UserGroup(UserGroupId id, UserGroup parent, params PermissionToken[] permissions) { this.Id = id; this.Permissions = parent.Permissions + new PermissionCollection(permissions); }
public static bool CanEditUser(IUserPermissionContext permissionContext, UserGroupId groupId) { ParamIs.NotNull(() => permissionContext); return(CanEditGroupTo(permissionContext, groupId)); }
private void TestCanEdit(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular) { artist.Status = entryStatus; user.GroupId = userGroup; var result = EntryPermissionManager.CanEdit(new FakePermissionContext(user), artist); Assert.AreEqual(expected, result, "result"); }