예제 #1
0
        protected override void Overwrite(Application destination, Application source)
        {
            destination.Id           = source.Id;
            destination.MembershipId = source.MembershipId;
            destination.Sys          = source.Sys;

            if (this.IsIdentical(destination, source))
            {
                throw ErtisAuthException.IdenticalDocument();
            }

            if (string.IsNullOrEmpty(destination.Name))
            {
                destination.Name = source.Name;
            }

            if (string.IsNullOrEmpty(destination.Role))
            {
                destination.Role = source.Role;
            }

            if (destination.Permissions == null)
            {
                destination.Permissions = source.Permissions;
            }

            if (destination.Forbidden == null)
            {
                destination.Forbidden = source.Forbidden;
            }
        }
예제 #2
0
        protected override void Overwrite(UserType destination, UserType source)
        {
            destination.Id           = source.Id;
            destination.MembershipId = source.MembershipId;
            destination.Sys          = source.Sys;

            if (this.IsIdentical(destination, source))
            {
                throw ErtisAuthException.IdenticalDocument();
            }
        }
예제 #3
0
        protected override void Overwrite(MailHook destination, MailHook source)
        {
            destination.Id           = source.Id;
            destination.MembershipId = source.MembershipId;
            destination.Sys          = source.Sys;

            if (this.IsIdentical(destination, source))
            {
                throw ErtisAuthException.IdenticalDocument();
            }

            if (string.IsNullOrEmpty(destination.Name))
            {
                destination.Name = source.Name;
            }

            if (string.IsNullOrEmpty(destination.Description))
            {
                destination.Description = source.Description;
            }

            if (string.IsNullOrEmpty(destination.Event))
            {
                destination.Event = source.Event;
            }

            if (string.IsNullOrEmpty(destination.Status))
            {
                destination.Status = source.Status;
            }

            if (string.IsNullOrEmpty(destination.MailSubject))
            {
                destination.MailSubject = source.MailSubject;
            }

            if (string.IsNullOrEmpty(destination.MailTemplate))
            {
                destination.MailTemplate = source.MailTemplate;
            }

            if (string.IsNullOrEmpty(destination.FromName))
            {
                destination.FromName = source.FromName;
            }

            if (string.IsNullOrEmpty(destination.FromAddress))
            {
                destination.FromAddress = source.FromAddress;
            }
        }
예제 #4
0
        protected override void Overwrite(User destination, User source)
        {
            destination.Id           = source.Id;
            destination.MembershipId = source.MembershipId;
            destination.Sys          = source.Sys;

            if (this.IsIdentical(destination, source))
            {
                throw ErtisAuthException.IdenticalDocument();
            }

            if (string.IsNullOrEmpty(destination.Username))
            {
                destination.Username = source.Username;
            }

            if (string.IsNullOrEmpty(destination.EmailAddress))
            {
                destination.EmailAddress = source.EmailAddress;
            }

            if (string.IsNullOrEmpty(destination.FirstName))
            {
                destination.FirstName = source.FirstName;
            }

            if (string.IsNullOrEmpty(destination.LastName))
            {
                destination.LastName = source.LastName;
            }

            if (string.IsNullOrEmpty(destination.Role))
            {
                destination.Role = source.Role;
            }

            if (destination is UserWithPassword destinationWithPassword)
            {
                if (source is UserWithPassword sourceWithPassword)
                {
                    destinationWithPassword.PasswordHash = sourceWithPassword.PasswordHash;
                }
            }
        }
예제 #5
0
        protected override void Overwrite(Webhook destination, Webhook source)
        {
            destination.Id           = source.Id;
            destination.MembershipId = source.MembershipId;
            destination.Sys          = source.Sys;

            if (this.IsIdentical(destination, source))
            {
                throw ErtisAuthException.IdenticalDocument();
            }

            if (string.IsNullOrEmpty(destination.Name))
            {
                destination.Name = source.Name;
            }

            if (string.IsNullOrEmpty(destination.Description))
            {
                destination.Description = source.Description;
            }

            if (string.IsNullOrEmpty(destination.Event))
            {
                destination.Event = source.Event;
            }

            if (string.IsNullOrEmpty(destination.Status))
            {
                destination.Status = source.Status;
            }

            // ReSharper disable once ConvertIfStatementToNullCoalescingAssignment
            if (destination.RequestList == null)
            {
                destination.RequestList = source.RequestList;
            }

            if (destination.TryCount == 0)
            {
                destination.TryCount = source.TryCount;
            }
        }
예제 #6
0
        protected override void Overwrite(OAuthProvider destination, OAuthProvider source)
        {
            destination.Id           = source.Id;
            destination.MembershipId = source.MembershipId;
            destination.Sys          = source.Sys;

            if (this.IsIdentical(destination, source))
            {
                throw ErtisAuthException.IdenticalDocument();
            }

            if (string.IsNullOrEmpty(destination.Name))
            {
                destination.Name = source.Name;
            }

            if (destination.Description == null)
            {
                destination.Description = source.Description;
            }
        }