Exemple #1
0
        public UpdateAuthorityGroupResponse UpdateAuthorityGroup(UpdateAuthorityGroupRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail");

            var authorityGroup = PersistenceContext.Load <AuthorityGroup>(request.AuthorityGroupDetail.AuthorityGroupRef);

            if (authorityGroup.BuiltIn || request.AuthorityGroupDetail.BuiltIn)
            {
                throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups);
            }

            if (authorityGroup.DataGroup && !request.AuthorityGroupDetail.DataGroup)
            {
                var user = GetUser(Thread.CurrentPrincipal.Identity.Name, PersistenceContext);
                if (!user.Password.Verify(request.Password))
                {
                    // the error message is deliberately vague
                    throw new UserAccessDeniedException();
                }
            }

            // set properties from request
            var assembler = new AuthorityGroupAssembler();

            assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

            PersistenceContext.SynchState();

            return(new UpdateAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)));
        }
        public AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request)
        {
            // create new group
            var authorityGroup = new AuthorityGroup();

            // set properties from request
            var assembler = new AuthorityGroupAssembler();

            assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

            // save
            PersistenceContext.Lock(authorityGroup, DirtyState.New);
            PersistenceContext.SynchState();

            return(new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)));
        }
        public UpdateAuthorityGroupResponse UpdateAuthorityGroup(UpdateAuthorityGroupRequest request)
        {
            var authorityGroup = PersistenceContext.Load <AuthorityGroup>(request.AuthorityGroupDetail.AuthorityGroupRef);

            if (authorityGroup.DataGroup && !request.AuthorityGroupDetail.DataGroup)
            {
                var user = GetUser(Thread.CurrentPrincipal.Identity.Name, PersistenceContext);
                if (!user.Password.Verify(request.Password))
                {
                    // the error message is deliberately vague
                    throw new UserAccessDeniedException();
                }
            }

            // set properties from request
            var assembler = new AuthorityGroupAssembler();

            assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

            PersistenceContext.SynchState();

            return(new UpdateAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)));
        }
Exemple #4
0
        public AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail");

            if (request.AuthorityGroupDetail.BuiltIn)
            {
                throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups);
            }

            // create new group
            var authorityGroup = new AuthorityGroup();

            // set properties from request
            var assembler = new AuthorityGroupAssembler();

            assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

            // save
            PersistenceContext.Lock(authorityGroup, DirtyState.New);
            PersistenceContext.SynchState();

            return(new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup)));
        }
		public UpdateAuthorityGroupResponse UpdateAuthorityGroup(UpdateAuthorityGroupRequest request)
		{
			var authorityGroup = PersistenceContext.Load<AuthorityGroup>(request.AuthorityGroupDetail.AuthorityGroupRef);

            if (authorityGroup.DataGroup && !request.AuthorityGroupDetail.DataGroup)
            {
                var user = GetUser(Thread.CurrentPrincipal.Identity.Name, PersistenceContext);
                if (!user.Password.Verify(request.Password))
                {
                    // the error message is deliberately vague
                    throw new UserAccessDeniedException(); 
                }
            }

			// set properties from request
			var assembler = new AuthorityGroupAssembler();
			assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

			PersistenceContext.SynchState();

			return new UpdateAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup));
		}
		public AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request)
		{
			// create new group
			var authorityGroup = new AuthorityGroup();

			// set properties from request
			var assembler = new AuthorityGroupAssembler();
			assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

			// save
			PersistenceContext.Lock(authorityGroup, DirtyState.New);
			PersistenceContext.SynchState();

			return new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup));
		}
		public AddAuthorityGroupResponse AddAuthorityGroup(AddAuthorityGroupRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail");

			if (request.AuthorityGroupDetail.BuiltIn)
				throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups);

			// create new group
			var authorityGroup = new AuthorityGroup();

			// set properties from request
			var assembler = new AuthorityGroupAssembler();
			assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

			// save
			PersistenceContext.Lock(authorityGroup, DirtyState.New);
			PersistenceContext.SynchState();

			return new AddAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup));
		}
		public UpdateAuthorityGroupResponse UpdateAuthorityGroup(UpdateAuthorityGroupRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.AuthorityGroupDetail, "AuthorityGroupDetail");

			var authorityGroup = PersistenceContext.Load<AuthorityGroup>(request.AuthorityGroupDetail.AuthorityGroupRef);
			if (authorityGroup.BuiltIn || request.AuthorityGroupDetail.BuiltIn)
				throw new RequestValidationException(SR.MessageCannotManageBuiltInAuthorityGroups);

			if (authorityGroup.DataGroup && !request.AuthorityGroupDetail.DataGroup)
			{
				var user = GetUser(Thread.CurrentPrincipal.Identity.Name, PersistenceContext);
				if (!user.Password.Verify(request.Password))
				{
					// the error message is deliberately vague
					throw new UserAccessDeniedException();
				}
			}

			// set properties from request
			var assembler = new AuthorityGroupAssembler();
			assembler.UpdateAuthorityGroup(authorityGroup, request.AuthorityGroupDetail, PersistenceContext);

			PersistenceContext.SynchState();

			return new UpdateAuthorityGroupResponse(assembler.CreateAuthorityGroupSummary(authorityGroup));
		}