public void UnlockItems(Authentication authentication, string userID) { this.ValidateUnlockItems(authentication, userID); var query = from ITypeItem item in this where item.IsLocked let lockInfo = item.LockInfo where lockInfo.Path == item.Path && lockInfo.ID == userID select item; var items = query.ToArray(); if (items.Any() == false) { return; } foreach (var item in items) { if (item is Type type) { type.UnlockInternal(authentication); } else if (item is TypeCategory category) { category.UnlockInternal(authentication); } } authentication.Sign(); var metaData = EventMetaDataBuilder.Build(items, LockChangeType.Unlock); this.OnItemsLockChanged(new ItemsEventArgs <ITypeItem>(authentication, items, metaData)); }
public void UnlockItems(Authentication authentication, string userID) { this.Dispatcher?.VerifyAccess(); this.ValidateUnlockItems(authentication, userID); this.Sign(authentication); var query = from ITableItem item in this let lockInfo = item.LockInfo where lockInfo.IsLocked == true && lockInfo.IsInherited == false && lockInfo.IsOwner(userID) select item; var items = query.ToArray(); if (items.Any() == false) { return; } foreach (var item in items) { item.Unlock(authentication); } var metaData = EventMetaDataBuilder.Build(items, LockChangeType.Unlock); this.OnItemsLockChanged(new ItemsEventArgs <ITableItem>(authentication, items, metaData)); }
public void InvokeItemsUnlockedEvent(Authentication authentication, ITypeItem[] items) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsUnlockedEvent), items); var message = EventMessageBuilder.UnlockTypeItem(authentication, items); var metaData = EventMetaDataBuilder.Build(items, LockChangeType.Unlock); this.CremaHost.Debug(eventLog); this.CremaHost.Info(message); this.OnItemsLockChanged(new ItemsEventArgs <ITypeItem>(authentication, items, metaData)); }
public void InvokeItemsRemoveAccessMemberEvent(Authentication authentication, ITypeItem[] items, string[] memberIDs) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsRemoveAccessMemberEvent), items, memberIDs); var message = EventMessageBuilder.RemoveAccessMemberFromTypeItem(authentication, items, memberIDs); var metaData = EventMetaDataBuilder.Build(items, AccessChangeType.Remove, memberIDs); this.CremaHost.Debug(eventLog); this.CremaHost.Info(message); this.OnItemsAccessChanged(new ItemsEventArgs <ITypeItem>(authentication, items, metaData)); }
public void InvokeItemsSetPrivateEvent(Authentication authentication, ITypeItem[] items) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsSetPrivateEvent), items); var message = EventMessageBuilder.SetPrivateTypeItem(authentication, items); var metaData = EventMetaDataBuilder.Build(items, AccessChangeType.Private); this.CremaHost.Debug(eventLog); this.CremaHost.Info(message); this.OnItemsAccessChanged(new ItemsEventArgs <ITypeItem>(authentication, items, metaData)); }
public void InvokeItemsLockedEvent(Authentication authentication, ITableItem[] items, string[] comments) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsLockedEvent), items, comments); var comment = EventMessageBuilder.LockTableItem(authentication, items, comments); var metaData = EventMetaDataBuilder.Build(items, LockChangeType.Lock, comments); this.CremaHost.Debug(eventLog); this.CremaHost.Info(comment); this.OnItemsLockChanged(new ItemsEventArgs <ITableItem>(authentication, items, metaData)); }
public void InvokeUsersUnbannedEvent(Authentication authentication, User[] users) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeUsersUnbannedEvent), users); var comment = EventMessageBuilder.UnbanUser(authentication, users); var metaData = EventMetaDataBuilder.Build(users, BanChangeType.Unban); this.CremaHost.Debug(eventLog); this.CremaHost.Info(comment); this.OnUsersBanChanged(new ItemsEventArgs <IUser>(authentication, users, metaData)); this.Context.InvokeItemsChangedEvent(authentication, users); }
public void InvokeItemsRemoveAccessMemberEvent(Authentication authentication, string basePath, IDataBase[] items, string[] memberIDs) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsRemoveAccessMemberEvent), items, memberIDs); var comment = EventMessageBuilder.RemoveAccessMemberFromDataBase(authentication, items, memberIDs); var metaData = EventMetaDataBuilder.Build(items, AccessChangeType.Remove, memberIDs); this.CremaHost.Debug(eventLog); this.repository.Commit(basePath, comment, authentication, eventLog); this.CremaHost.Info(comment); this.OnItemsAccessChanged(new ItemsEventArgs <IDataBase>(authentication, items, new object[] { AccessChangeType.Remove, memberIDs, })); }
public void InvokeItemsSetPrivateEvent(Authentication authentication, string basePath, IDataBase[] items) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsSetPrivateEvent), items); var comment = EventMessageBuilder.SetPrivateDataBase(authentication, items); var metaData = EventMetaDataBuilder.Build(items, AccessChangeType.Private); this.CremaHost.Debug(eventLog); this.repository.Commit(basePath, comment, authentication, eventLog); this.CremaHost.Info(comment); this.OnItemsAccessChanged(new ItemsEventArgs <IDataBase>(authentication, items, metaData)); }
public void InvokeItemsSetAccessMemberEvent(Authentication authentication, ITableItem[] items, string[] memberIDs, AccessType[] accessTypes) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsSetAccessMemberEvent), items, memberIDs, accessTypes); var comment = EventMessageBuilder.SetAccessMemberOfTableItem(authentication, items, memberIDs, accessTypes); var metaData = EventMetaDataBuilder.Build(items, AccessChangeType.Set, memberIDs, accessTypes); this.CremaHost.Debug(eventLog); this.repository.Commit(authentication, comment, eventLog); this.CremaHost.Info(comment); this.OnItemsAccessChanged(new ItemsEventArgs <ITableItem>(authentication, items, metaData)); }
public void InvokeItemsSetPublicEvent(Authentication authentication, ITypeItem[] items) { var eventLog = EventLogBuilder.BuildMany(authentication, this, nameof(InvokeItemsSetPublicEvent), items); var comment = EventMessageBuilder.SetPublicTypeItem(authentication, items); var metaData = EventMetaDataBuilder.Build(items, AccessChangeType.Public); this.CremaHost.Debug(eventLog); //this.repository.Commit(authentication, comment, eventLog); this.CremaHost.Info(comment); this.OnItemsAccessChanged(new ItemsEventArgs <ITypeItem>(authentication, items, metaData)); }