예제 #1
0
        public void InvokeDataBaseAddAccessMember(Authentication authentication, DataBase dataBase, AccessInfo accessInfo, string memberID, AccessType accessType)
        {
            this.CremaHost.DebugMethod(authentication, this, nameof(InvokeDataBaseAddAccessMember), dataBase, memberID, accessType);
            var accessInfoPath = dataBase.GetAccessInfoPath();

            try
            {
                accessInfo.Add(authentication.SignatureDate, memberID, accessType);
                dataBase.WriteAccessInfo(accessInfoPath, accessInfo);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                this.repository.Revert(dataBase.BasePath);
                throw e;
            }
        }
예제 #2
0
        public void InvokeTableItemAddAccessMember(Authentication authentication, ITableItem tableItem, AccessInfo accessInfo, string memberID, AccessType accessType)
        {
            this.CremaHost.DebugMethod(authentication, this, nameof(InvokeTableItemAddAccessMember), tableItem, memberID, accessType);
            var accessInfoPath = tableItem.GetAccessInfoPath();

            try
            {
                accessInfo.Add(authentication.SignatureDate, memberID, accessType);
                tableItem.WriteAccessInfo(accessInfoPath, accessInfo);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                this.repository.Revert();
                throw e;
            }
        }
예제 #3
0
        public Task <AccessInfo> InvokeTypeItemAddAccessMemberAsync(Authentication authentication, string typeItemPath, AccessInfo accessInfo, string memberID, AccessType accessType)
        {
            var message = EventMessageBuilder.AddAccessMemberToTypeItem(authentication, typeItemPath, memberID, accessType);

            return(this.Repository.Dispatcher.InvokeAsync(() =>
            {
                try
                {
                    var itemPath = new RepositoryPath(this, typeItemPath);
                    var signatureDate = authentication.Sign();
                    accessInfo.Add(signatureDate, memberID, accessType);
                    this.Serializer.Serialize(itemPath, (AccessSerializationInfo)accessInfo, AccessSerializationInfo.Settings);
                    this.Repository.Commit(authentication, message);
                    return accessInfo;
                }
                catch
                {
                    this.Repository.Revert();
                    throw;
                }
            }));
        }