Esempio n. 1
0
        public static List <string> ReasonsForNotBeingClonable(this EditionEntityLight edition, CedUser user)
        {
            var reasons = new List <string>();

            if (!edition.IsClonable(user))
            {
                if (!WebConfigHelper.CloningAllowed)
                {
                    reasons.Add("Cloning not allowed.");
                    return(reasons);
                }

                if (!Constants.ValidEventActivitiesToClone.Select(x => x.ToLower()).ToArray().Contains(edition.EventActivity.ToLower()))
                {
                    reasons.Add(edition.EventActivity);
                }

                if (!Constants.ValidEditionStatusesToClone.Contains(edition.Status))
                {
                    reasons.Add(edition.Status.ToEnum <EditionStatusType>().GetDescription());
                }

                if (!edition.DirectorEmails.Contains(user.CurrentUser.Email.ToLower()))
                {
                    reasons.Add("You don't have permission.");
                }
            }

            return(reasons);
        }