/// <summary> /// Create a new AccessControl. This AccessControl is automatically dirty. /// </summary> /// <param name="user">The user who (will) have access.</param> /// <param name="entity">The entity that the user has access to.</param> /// <param name="accessRight">The rights the user has.</param> /// /// <param name="tenant">The tenant id of this user.</param> public AccessControl(RightsHolder user, Entity entity, AccessRight accessRight, Guid tenant) { this.user = user; this.entity = entity; this.accessRight = accessRight; this.dirty = true; this.deleted = false; this.newRights = true; this.tenantId = tenant; }
/// <summary> /// Save the selected user and close the window. If there was no selection and only a single matched user, save that user instead. /// </summary> /// <param name="sender">The okay button.</param> /// <param name="eventArgs">The event arguments.</param> private void OnOkay(object sender, RoutedEventArgs eventArgs) { if (usersFound.Items.Count == 1) { this.selectedUser = this.usersFound.Items[0] as RightsHolder; } else if (usersFound.Items.Count > 0) { this.selectedUser = this.usersFound.SelectedItem as RightsHolder; } this.Close(); }
/// <summary> /// Create an new AccessControl from a AccessControl. /// </summary> /// <param name="access">The source object.</param> public AccessControl(AccessControl access) { this.accessControlId = access.AccessControlId; this.user = access.User.Clone() as RightsHolder; this.entity = new Entity(access.Entity); this.tenantId = access.TenantId; this.accessRight = access.AccessRight; this.rowVersion = access.RowVersion; this.dirty = access.Dirty; this.deleted = access.Deleted; this.newRights = access.newRights; }
/// <summary> /// Create an new AccessControl from a AccessControlRow. /// </summary> /// <param name="accessControlRow">The row to base this object on.</param> public AccessControl(AccessControlRow accessControlRow) { this.accessControlId = accessControlRow.AccessControlId; this.user = Entity.New(accessControlRow.RightsHolderRow.EntityRow) as RightsHolder; this.entity = new Entity(accessControlRow.EntityRow); this.tenantId = accessControlRow.TenantRow.TenantId; this.accessRight = accessControlRow.AccessRightRow.AccessRightCode; this.rowVersion = accessControlRow.RowVersion; this.dirty = false; this.deleted = false; this.newRights = false; }
/// <summary> /// Create a new rights holder based on another one. /// </summary> /// <param name="entity">The entity to base the new one on.</param> public RightsHolder(Entity entity) : base(entity) { RightsHolder source = entity as RightsHolder; this.tenant = source.Tenant; }