コード例 #1
0
		private void AssertEqual(User expected, UserContract actual) {
			
			Assert.IsNotNull(actual, "Cannot be null");
			Assert.AreEqual(expected.Name, actual.Name, "Name");
			Assert.AreEqual(expected.Id, actual.Id, "Id");

		}
コード例 #2
0
        public AlbumCollection(UserContract user, AlbumCollectionRouteParams routeParams)
        {
            User = user;
            RouteParams = routeParams;

            FilterByPurchaseStatus = routeParams.purchaseStatus ?? PurchaseStatus.Nothing;
        }
コード例 #3
0
        public ArtistForUserContract(OwnedArtistForUser ownedArtistForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => ownedArtistForUser);

            Artist = new ArtistContract(ownedArtistForUser.Artist, languagePreference);
            Id     = ownedArtistForUser.Id;
            User   = new UserContract(ownedArtistForUser.User);
        }
コード例 #4
0
        public ArtistForUserContract(OwnedArtistForUser ownedArtistForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => ownedArtistForUser);

            Artist = new ArtistContract(ownedArtistForUser.Artist, languagePreference);
            Id = ownedArtistForUser.Id;
            User = new UserContract(ownedArtistForUser.User);
        }
コード例 #5
0
ファイル: FavoriteSongs.cs プロジェクト: realzhaorong/vocadb
 public FavoriteSongs(UserContract user, SongVoteRating rating, SongSortRule? sort, bool? groupByRating)
     : this()
 {
     GroupByRating = groupByRating;
     Rating = rating;
     Sort = sort;
     User = user;
 }
コード例 #6
0
        public SongListContract(SongList list, IUserPermissionContext permissionContext)
            : base(list)
        {
            ParamIs.NotNull(() => list);

            Author = new UserContract(list.Author);
            CanEdit = EntryPermissionManager.CanEdit(permissionContext, list);
            Description = list.Description;
            FeaturedCategory = list.FeaturedCategory;
        }
コード例 #7
0
        public AlbumForUserContract(AlbumForUser albumForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => albumForUser);

            Album          = new AlbumContract(albumForUser.Album, languagePreference);
            Id             = albumForUser.Id;
            MediaType      = albumForUser.MediaType;
            PurchaseStatus = albumForUser.PurchaseStatus;
            Rating         = albumForUser.Rating;
            User           = new UserContract(albumForUser.User);
        }
コード例 #8
0
        public ActivityEntryContract(ArchivedObjectVersion entry, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => entry);

            ArtistString = GetArtistString(entry.EntryBase, languagePreference);
            Author = new UserContract(entry.Author);
            CreateDate = entry.Created;
            EditEvent = entry.EditEvent;
            EntryRef = new EntryRefWithNameContract(entry.EntryBase, languagePreference);
            SongThumbUrl = GetSongThumbUrl(entry.EntryBase);
        }
コード例 #9
0
        public AlbumForUserContract(AlbumForUser albumForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => albumForUser);

            Album = new AlbumWithAdditionalNamesContract(albumForUser.Album, languagePreference);
            Id = albumForUser.Id;
            MediaType = albumForUser.MediaType;
            PurchaseStatus = albumForUser.PurchaseStatus;
            Rating = albumForUser.Rating;
            User = new UserContract(albumForUser.User);
        }
コード例 #10
0
        public NewsEntryContract(NewsEntry newsEntry)
        {
            ParamIs.NotNull(() => newsEntry);

            Anonymous = newsEntry.Anonymous;
            Author = new UserContract(newsEntry.Author);
            CreateDate = newsEntry.CreateDate;
            Id = newsEntry.Id;
            Important = newsEntry.Important;
            Stickied = newsEntry.Stickied;
            Text = newsEntry.Text;
        }
コード例 #11
0
		public ActivityEntryContract(ActivityEntry entry, ContentLanguagePreference languagePreference) {

			ParamIs.NotNull(() => entry);

			ArtistString = GetArtistString(entry.EntryBase, languagePreference);
			Author = new UserContract(entry.Author);
			CreateDate = entry.CreateDate;
			EditEvent = entry.EditEvent;
			EntryRef = new EntryWithImageContract(entry.EntryBase, GetMime(entry.EntryBase), languagePreference);
			SongThumbUrl = GetSongThumbUrl(entry.EntryBase);

		}
コード例 #12
0
ファイル: UserMessageContract.cs プロジェクト: sethura/vocadb
        public UserMessageContract(UserMessage message)
        {
            ParamIs.NotNull(() => message);

            Body         = message.Message;
            Created      = message.Created;
            HighPriority = message.HighPriority;
            Id           = message.Id;
            Read         = message.Read;
            Receiver     = new UserContract(message.Receiver);
            Sender       = new UserContract(message.Sender);
            Subject      = message.Subject;
        }
コード例 #13
0
        public UserMessageContract(UserMessage message)
        {
            ParamIs.NotNull(() => message);

            Body = message.Message;
            Created = message.Created;
            HighPriority = message.HighPriority;
            Id = message.Id;
            Read = message.Read;
            Receiver = new UserContract(message.Receiver);
            Sender = new UserContract(message.Sender);
            Subject = message.Subject;
        }
コード例 #14
0
ファイル: UserController.cs プロジェクト: realzhaorong/vocadb
 private bool HandleCreate(UserContract user)
 {
     if (user == null) {
         ModelState.AddModelError("UserName", ViewRes.User.CreateStrings.UsernameTaken);
         return false;
     } else {
         FormsAuthentication.SetAuthCookie(user.Name, false);
         return true;
     }
 }
コード例 #15
0
ファイル: LoginManager.cs プロジェクト: realzhaorong/vocadb
        public static void SetLoggedUser(UserContract user)
        {
            ParamIs.NotNull(() => user);

            if (!HttpContext.Current.User.Identity.IsAuthenticated)
                throw new InvalidOperationException("Must be authenticated");

            HttpContext.Current.User = new VocaDbPrincipal(HttpContext.Current.User.Identity, user);
        }
コード例 #16
0
 public VocaDbPrincipal(IIdentity identity, UserContract user)
     : base(identity, new string[] {})
 {
     this.user = user;
 }