类javax.naming.NoPermissionException源码实例Demo

下面列出了怎么用javax.naming.NoPermissionException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: MeetingFilm   文件: UserMgrController.java
/**
 * 修改管理员
 *
 * @throws NoPermissionException
 */
@RequestMapping("/edit")
@BussinessLog(value = "修改管理员", key = "account", dict = UserDict.class)
@ResponseBody
public Tip edit(@Valid UserDto user, BindingResult result) throws NoPermissionException {
    if (result.hasErrors()) {
        throw new GunsException(BizExceptionEnum.REQUEST_NULL);
    }

    User oldUser = userService.selectById(user.getId());

    if (ShiroKit.hasRole(Const.ADMIN_NAME)) {
        this.userService.updateById(UserFactory.editUser(user, oldUser));
        return SUCCESS_TIP;
    } else {
        assertAuth(user.getId());
        ShiroUser shiroUser = ShiroKit.getUser();
        if (shiroUser.getId().equals(user.getId())) {
            this.userService.updateById(UserFactory.editUser(user, oldUser));
            return SUCCESS_TIP;
        } else {
            throw new GunsException(BizExceptionEnum.NO_PERMITION);
        }
    }
}
 
源代码2 项目: WebStack-Guns   文件: UserMgrController.java
/**
 * 修改管理员
 *
 * @throws NoPermissionException
 */
@RequestMapping("/edit")
@BussinessLog(value = "修改管理员", key = "account", dict = UserDict.class)
@ResponseBody
public ResponseData edit(@Valid UserDto user, BindingResult result) throws NoPermissionException {
    if (result.hasErrors()) {
        throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
    }

    User oldUser = userService.selectById(user.getId());

    if (ShiroKit.hasRole(Const.ADMIN_NAME)) {
        this.userService.updateById(UserFactory.editUser(user, oldUser));
        return SUCCESS_TIP;
    } else {
        assertAuth(user.getId());
        ShiroUser shiroUser = ShiroKit.getUser();
        if (shiroUser.getId().equals(user.getId())) {
            this.userService.updateById(UserFactory.editUser(user, oldUser));
            return SUCCESS_TIP;
        } else {
            throw new ServiceException(BizExceptionEnum.NO_PERMITION);
        }
    }
}
 
源代码3 项目: onboard   文件: DiscussionAPIController.java
@RequestMapping(value = "/{discussionId}", method = RequestMethod.PUT)
@Interceptors({ ProjectMemberRequired.class, ProjectNotArchivedRequired.class })
@ResponseBody
public Object updateDiscussion(@PathVariable("companyId") int companyId, @PathVariable("projectId") int projectId,
        @PathVariable("discussionId") int discussionId, @Valid @RequestBody DiscussionForm form,
        @RequestParam(value = "recover", defaultValue = "false", required = true) Boolean recover)
        throws NoPermissionException {
    if (recover) {
        return recoverDiscussion(discussionId);
    }
    logger.info("Updating discussion " + discussionId);
    logger.info("attachments " + form.getAttachments().size());
    form.setProjectId(projectId);
    form.setCompanyId(companyId);
    discussionService.updateSelective(form);
    Topic topic = topicService.getTopicByTypeAndId(form.getType(), form.getId());
    TopicDTO result = TopicTransform.topicToTopicDTO(topic);
    logger.info("add comment count...");
    addCommentCount(result);
    logger.info("Finishing...");
    return result;
}
 
源代码4 项目: onboard   文件: DiscussionAPIController.java
private Map<String, ?> recoverDiscussion(@PathVariable("discussionId") int discussionId)
        throws NoPermissionException {
    logger.info("recovering " + discussionId);
    Discussion discussion = discussionService.getById(discussionId);
    if (discussion.getId().equals(session.getCurrentUser().getId())) {
        throw new NoPermissionException();
    }
    discussion.setDeleted(false);
    discussionService.updateSelective(discussion);
    // discussionService.discardDiscussion(discussionId);
    discussion = discussionService.getByIdWithDetail(discussionId);
    DiscussionDTO discussionDto = DiscussionTransform.discussionToDiscussionDTOWithDetail(discussion);
    Topic topic = topicService.getTopicByTypeAndId(discussion.getType(), discussion.getId());
    TopicDTO topicDTO = TopicTransform.topicToTopicDTO(topic);
    addCommentCount(topicDTO);
    return ImmutableMap.of("discussion", discussionDto, "topic", topicDTO);

}
 
源代码5 项目: molgenis   文件: AccountController.java
@PostMapping(value = "/register", headers = "Content-Type=application/x-www-form-urlencoded")
@ResponseBody
public Map<String, String> registerUser(
    @Valid @ModelAttribute RegisterRequest registerRequest, HttpServletRequest request)
    throws Exception {
  if (authenticationSettings.getSignUp()) {
    if (!registerRequest.getPassword().equals(registerRequest.getConfirmPassword())) {
      throw new BindException(RegisterRequest.class, "password does not match confirm password");
    }
    if (appSettings.getRecaptchaIsEnabled()
        && !reCaptchaService.validate(registerRequest.getRecaptcha())) {
      throw new CaptchaException("invalid captcha answer");
    }
    User user = toUser(registerRequest);
    String activationUri =
        ServletUriComponentsBuilder.fromCurrentRequest()
            .replacePath(URI + "/activate")
            .toUriString();
    accountService.createUser(user, activationUri);

    String successMessage =
        authenticationSettings.getSignUpModeration()
            ? REGISTRATION_SUCCESS_MESSAGE_ADMIN
            : REGISTRATION_SUCCESS_MESSAGE_USER;
    return Collections.singletonMap("message", successMessage);
  } else {
    throw new NoPermissionException("Self registration is disabled");
  }
}
 
源代码6 项目: gemfirexd-oss   文件: ContextImpl.java
/**
 * Checks if this context has been destroyed. isDestroyed is set to true when
 * a context is destroyed by calling destroySubcontext method.
 * 
 * @throws NoPermissionException if this context has been destroyed
 */
private void checkIsDestroyed() throws NamingException {
  if (isDestroyed) { throw new NoPermissionException(LocalizedStrings.ContextImpl_CAN_NOT_INVOKE_OPERATIONS_ON_DESTROYED_CONTEXT.toLocalizedString()); }
}
 
源代码7 项目: gemfirexd-oss   文件: ContextImpl.java
/**
 * Checks if this context has been destroyed. isDestroyed is set to true when
 * a context is destroyed by calling destroySubcontext method.
 * 
 * @throws NoPermissionException if this context has been destroyed
 */
private void checkIsDestroyed() throws NamingException {
  if (isDestroyed) { throw new NoPermissionException(LocalizedStrings.ContextImpl_CAN_NOT_INVOKE_OPERATIONS_ON_DESTROYED_CONTEXT.toLocalizedString()); }
}
 
 类所在包
 同包方法