Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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, }));
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
        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));
        }