Esempio n. 1
0
        public void InvokeUserAdded(Authentication authentication, DomainUserInfo domainUserInfo, DomainUserState domainUserState)
        {
            this.dispatcher.VerifyAccess();

            var domainUser = new DomainUser(this, domainUserInfo, domainUserState);

            this.users.Add(domainUser);
            if (domainUser.IsOwner == true)
            {
                this.users.Owner = domainUser;
            }
            this.OnUserAdded(new DomainUserEventArgs(authentication, this, domainUser));
            this.Container.InvokeDomainUserAddedEvent(authentication, this, domainUser);
        }
Esempio n. 2
0
 protected override void OnRemoveRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
 {
     foreach (var item in rows.Reverse())
     {
         var view = this.views[item.TableName];
         if (DomainRowInfo.ClearKey.SequenceEqual(item.Keys) == true)
         {
             view.Table.Clear();
         }
         else
         {
             CremaDomainUtility.Delete(view, item.Keys);
         }
         this.tables[view].ContentsInfo = signatureDate;
     }
     this.dataSet.AcceptChanges();
 }
Esempio n. 3
0
 protected override void OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
 {
     this.dataType.BeginLoadData();
     try
     {
         foreach (var item in rows)
         {
             CremaDomainUtility.SetFieldsForce(this.view, item.Keys, item.Fields);
         }
     }
     finally
     {
         this.dataType.EndLoadData();
     }
     this.dataType.ModificationInfo = signatureDate;
     this.dataType.AcceptChanges();
 }
Esempio n. 4
0
 protected override void OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
 {
     this.dataSet.BeginLoad();
     try
     {
         foreach (var item in rows)
         {
             var view = this.views[item.TableName];
             CremaDomainUtility.SetFieldsForce(view, item.Keys, item.Fields);
             this.tables[view].ContentsInfo = signatureDate;
         }
     }
     finally
     {
         this.dataSet.EndLoad();
     }
     this.dataSet.AcceptChanges();
 }
Esempio n. 5
0
        protected override void OnRemoveRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataType.SignatureDateProvider = signatureProvider;

            try
            {
                foreach (var item in rows)
                {
                    CremaDomainUtility.Delete(this.view, item.Keys);
                }

                this.dataType.AcceptChanges();
            }
            catch (Exception e)
            {
                this.dataType.RejectChanges();
                throw e;
            }
        }
Esempio n. 6
0
        protected override DomainRowInfo[] OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataType.SignatureDateProvider = signatureProvider;

            try
            {
                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i].Fields = CremaDomainUtility.SetFields(this.view, rows[i].Keys, rows[i].Fields);
                }

                this.dataType.AcceptChanges();

                return(rows);
            }
            catch (Exception e)
            {
                this.dataType.RejectChanges();
                throw e;
            }
        }
Esempio n. 7
0
        protected override DomainRowInfo[] OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataSet.SignatureDateProvider = signatureProvider;

            try
            {
                for (var i = 0; i < rows.Length; i++)
                {
                    var view = this.views[rows[i].TableName];
                    rows[i].Fields = CremaDomainUtility.SetFields(view, rows[i].Keys, rows[i].Fields);
                }

                this.dataSet.AcceptChanges();
                return(rows);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                this.dataSet.RejectChanges();
                throw e;
            }
        }
Esempio n. 8
0
        protected override DomainRowInfo[] OnNewRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataType.SignatureDateProvider = signatureProvider;

            try
            {
                for (int i = 0; i < rows.Length; i++)
                {
                    var rowView = CremaDomainUtility.AddNew(this.view, rows[i].Fields);
                    rows[i].Keys   = CremaDomainUtility.GetKeys(rowView);
                    rows[i].Fields = CremaDomainUtility.GetFields(rowView);
                }
                this.dataType.AcceptChanges();

                return(rows);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                this.dataType.RejectChanges();
                throw e;
            }
        }
Esempio n. 9
0
 protected override void OnSetProperty(DomainUser domainUser, string propertyName, object value, SignatureDateProvider signatureProvider)
 {
     if (propertyName == "TableName")
     {
         if (this.IsNew == false)
         {
             throw new InvalidOperationException(Resources.Exception_CannotRename);
         }
         this.template.TableName = (string)value;
     }
     else if (propertyName == "Comment")
     {
         this.template.Comment = (string)value;
     }
     else if (propertyName == "Tags")
     {
         this.template.Tags = (TagInfo)((string)value);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Esempio n. 10
0
 protected override void OnSetProperty(DomainUser domainUser, string propertyName, object value, SignatureDateProvider signatureProvider)
 {
     if (propertyName == "TableName")
     {
         if (this.IsNew == false)
         {
             throw new CremaException("테이블 이름은 변경할 수 없습니다.");
         }
         this.template.TableName = (string)value;
     }
     else if (propertyName == "Comment")
     {
         this.template.Comment = (string)value;
     }
     else if (propertyName == "Tags")
     {
         this.template.Tags = (TagInfo)((string)value);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Esempio n. 11
0
 protected virtual void OnRemoveRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
 {
 }
Esempio n. 12
0
 protected virtual DomainRowInfo[] OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
 {
     return(rows);
 }
Esempio n. 13
0
 private void InvokeAddUser(Authentication authentication, DomainAccessType accessType, out DomainUser domainUser)
 {
     domainUser = new DomainUser(this, authentication.ID, authentication.Name, accessType)
     {
         IsOnline = authentication.Types.HasFlag(AuthenticationType.User),
     };
     domainUser.Authentication = authentication;
     authentication.Expired   += Authentication_Expired;
 }
Esempio n. 14
0
 private void InvokeKick(Authentication authentication, string userID, string comment, out DomainUser domainUser, out RemoveInfo removeInfo)
 {
     removeInfo = new RemoveInfo(RemoveReason.Kick, comment);
     domainUser = this.users[userID];
 }
Esempio n. 15
0
 private void InvokeBeginUserEdit(Authentication authentication, DomainLocationInfo location, out DomainUser domainUser)
 {
     domainUser = this.GetDomainUser(authentication);
     this.OnBeginUserEdit(domainUser, location);
     domainUser.Location      = location;
     domainUser.IsBeingEdited = true;
 }
Esempio n. 16
0
 protected virtual void OnBeginUserEdit(DomainUser domainUser, DomainLocationInfo location)
 {
 }
Esempio n. 17
0
        public void InvokeDomainUserRemovedEvent(Authentication authentication, Domain domain, DomainUser domainUser, RemoveInfo removeInfo)
        {
            var args     = new DomainUserRemovedEventArgs(authentication, domain, domainUser, removeInfo);
            var eventLog = EventLogBuilder.Build(authentication, this, nameof(InvokeDomainUserRemovedEvent), domain, domainUser, removeInfo.Reason, removeInfo.Message);
            var comment  = removeInfo.Reason == RemoveReason.Kick
                ? EventMessageBuilder.KickDomainUser(authentication, domain, domainUser)
                : EventMessageBuilder.LeaveDomainUser(authentication, domain);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.CremaHost.Debug(eventLog);
                this.CremaHost.Info(comment);
                this.OnDomainUserRemoved(args);
            });
        }
Esempio n. 18
0
        public void InvokeDomainUserAddedEvent(Authentication authentication, Domain domain, DomainUser domainUser)
        {
            var args     = new DomainUserEventArgs(authentication, domain, domainUser);
            var eventLog = EventLogBuilder.Build(authentication, this, nameof(InvokeDomainUserAddedEvent), domain, domainUser);
            var comment  = EventMessageBuilder.EnterDomainUser(authentication, domain);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.CremaHost.Debug(eventLog);
                this.CremaHost.Info(comment);
                this.OnDomainUserAdded(args);
            });
        }
Esempio n. 19
0
 protected virtual void OnSetProperty(DomainUser domainUser, string propertyName, object value, SignatureDateProvider signatureProvider)
 {
 }
Esempio n. 20
0
 protected virtual void OnSetLocation(DomainUser domainUser, DomainLocationInfo location)
 {
 }
Esempio n. 21
0
        public void InvokeDomainUserChangedEvent(Authentication authentication, Domain domain, DomainUser domainUser)
        {
            var args = new DomainUserEventArgs(authentication, domain, domainUser);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.OnDomainUserChanged(args);
            });
        }
Esempio n. 22
0
 protected virtual void OnEndUserEdit(DomainUser domainUser)
 {
 }
Esempio n. 23
0
 private void InvokeKick(Authentication authentication, string userID, string comment, out DomainUser domainUser, out RemoveInfo removeInfo)
 {
     removeInfo = new RemoveInfo(RemoveReason.Kick, comment);
     domainUser = this.users[userID];
     if (domainUser.Authentication != null)
     {
         domainUser.Authentication.Expired -= Authentication_Expired;
         domainUser.Authentication          = null;
     }
 }
Esempio n. 24
0
 private void InvokeEndUserEdit(Authentication authentication, out DomainUser domainUser)
 {
     domainUser = this.GetDomainUser(authentication);
     this.OnEndUserEdit(domainUser);
     domainUser.IsBeingEdited = false;
 }
Esempio n. 25
0
 private void InvokeSetOwner(Authentication authentication, string userID, out DomainUser oldOwner, out DomainUser newOwner)
 {
     oldOwner = this.users.Owner;
     newOwner = this.users[userID];
 }
Esempio n. 26
0
 private void InvokeSetUserLocation(Authentication authentication, DomainLocationInfo location, out DomainUser domainUser)
 {
     domainUser = this.GetDomainUser(authentication);
     this.OnSetLocation(domainUser, location);
     domainUser.Location = location;
 }
Esempio n. 27
0
        protected virtual void OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
        {

        }