public bool HasValidationHelper(BaseDO domainObject, out IValidationHelper validationHelper)
 {
     //Check Direct Types
     Type type = domainObject.GetType();
     validationHelper = null;
     if (this.ValidationHelpers.ContainsKey(type))
     {
         validationHelper = this.ValidationHelpers[type];
     }
     return validationHelper != null;
 }
        public bool Validate(BaseDO domainObject, UserCredentials userCredentials)
        {
            IValidationHelper validationHelper;

            bool hasValidationHelper = HasValidationHelper(domainObject, out validationHelper);

            if (hasValidationHelper == false)
            {
                throw new Exception("The domain object doesnt have validtion helper");
            }

            ValidationStateDictionary validationStateDictionary = validationHelper.Validate(domainObject, userCredentials);
            if (validationStateDictionary.Count > 0)
            {
               throw new ValidationException(validationStateDictionary);
            }

               return true;
        }
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<ICommentManager, Comment>((Comment)domainObject, userCredentials, CommentManager);
 }
Пример #4
0
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<ITrackManager, Track>((Track)domainObject, userCredentials, TrackManager);
 }
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<IArtistManager, Artist>((Artist)domainObject, userCredentials, ArtistManager);
 }
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<INewsItemManager, NewsItem>((NewsItem)domainObject, userCredentials, NewsItemManager);
 }
 public IOwnershipHelper CreateHelper(BaseDO o)
 {
     IOwnershipHelper foundHelper = null;
     this.HasComponentHelper(o, out foundHelper);
     return foundHelper;
 }
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<IUserProfileManager, UserProfile>((UserProfile)domainObject, userCredentials, UserProfileManager);
 }
Пример #9
0
 public void RedirectUserIfAccessDenied( BaseDO baseDO)
 {
     IListenToUser user = (IListenToUser)this.HttpContext.User;
     UserCredentials userCredentials = user.UserCredentials;
     bool isOwner = OwnershipHelper.IsOwner(baseDO, userCredentials);
     if (!isOwner)
     {
         RedirectToAction(Routes.INFO_ERROR, new { });
     }
 }
Пример #10
0
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<IGigManager, Gig>((Gig)domainObject, userCredentials, GigManager);
 }
Пример #11
0
 public IIsNewHelper CreateHelper(BaseDO o)
 {
     IIsNewHelper foundHelper = null;
     this.HasHelper(o, out foundHelper);
     return foundHelper;
 }
Пример #12
0
 public bool IsOwner(BaseDO domainObject, UserCredentials userCredentials)
 {
     return this.IsOwner<IVenueManager, Venue>((Venue)domainObject, userCredentials, VenueManager);
 }