예제 #1
0
        public void Should_Throw_SecurityException_If_User_Does_Not_Belong_To_Group()
        {
            //ARRANGE
            var testSubjectUserId = 3;
            var groupId           = 10;
            var group             = new GroupEntity
            {
                GroupId    = groupId,
                UserGroups = new List <UserGroupEntity>
                {
                    new UserGroupEntity
                    {
                        GroupId = groupId,
                        UserId  = 1
                    },
                    new UserGroupEntity
                    {
                        GroupId = groupId,
                        UserId  = 2
                    }
                }
            };

            //ACT && ASSERT
            Assert.Throws <SecurityException>(() => SecurityAssertions.AssertThatUserBelongsToGroup(group, testSubjectUserId));
        }
예제 #2
0
        public CloudBlockBlob GetAttachmentForNote(int userId, int noteId)
        {
            var note = GetNote(noteId);

            SecurityAssertions.AssertThatUserBelongsToGroup(note.Group, userId);

            var file = GetBlobFromStorage(note.AttachmentIdentity);

            return(file);
        }