Package ru.org.linux.auth

Examples of ru.org.linux.auth.AccessViolationException


    Template tmpl = Template.getTemplate(request);

    PreparedTopic preparedTopic = messagePrepareService.prepareTopic(add.getTopic(), request.isSecure(), tmpl.getCurrentUser());

    if (!topicPermissionService.isCommentsAllowed(preparedTopic.getGroup(), add.getTopic(), tmpl.getCurrentUser())) {
      throw new AccessViolationException("Это сообщение нельзя комментировать");
    }

    if (add.getMode() == null) {
      add.setMode(tmpl.getFormatMode());
    }
View Full Code Here


                             ServletRequest request)
    throws AccessViolationException {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    ModelMap result = new ModelMap();
    EditBoxesRequest form = new EditBoxesRequest();
    form.setPosition(pos);
View Full Code Here

                         SessionStatus status, HttpServletRequest request)
    throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    ValidationUtils.rejectIfEmptyOrWhitespace(result, "position", "position.empty", "Не указанa позиция бокслета");
    if (result.hasErrors()) {
      return "remove-box";
View Full Code Here

          @RequestParam("watch") boolean watch
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    User user = tmpl.getCurrentUser();
    user.checkBlocked();
    user.checkAnonymous();
View Full Code Here

          @RequestParam("id") int id
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    User user = tmpl.getCurrentUser();
    user.checkBlocked();
    user.checkAnonymous();

    MemoriesListItem m = memoriesDao.getMemoriesListItem(id);

    if (m != null) {
      if (m.getUserid() != user.getId()) {
        throw new AccessViolationException("Нельзя удалить чужую запись");
      }

      memoriesDao.delete(id);

      return memoriesDao.getTopicStats(m.getTopic()).get(m.isWatch()?0:1);
View Full Code Here

  @Autowired
  private GroupPermissionService permissionService;

  private void checkDelete(PreparedTopic topic, User user) throws AccessViolationException {
    if (!permissionService.isEditable(topic, user)) {
      throw new AccessViolationException("Вы не можете редактировать эту тему");
    }

    if (topic.getSection().isImagepost()) {
      throw new AccessViolationException("В этой теме нельзя удалять изображения");
    }
  }
View Full Code Here

    HttpServletRequest request
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    Topic msg = messageDao.getById(msgid);

    if (msg.isDeleted()) {
      throw new UserErrorException("Сообщение уже удалено");
    }

    if (!permissionService.isDeletable(msg, tmpl.getCurrentUser())) {
      throw new AccessViolationException("Вы не можете удалить это сообщение");
    }

    Section section = sectionService.getSection(msg.getSectionId());

    HashMap<String, Object> params = new HashMap<>();
View Full Code Here

    HttpServletRequest request
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    User user = tmpl.getCurrentUser();

    user.checkAnonymous();

    Topic message = messageDao.getById(msgid);

    if (message.isDeleted()) {
      throw new UserErrorException("Сообщение уже удалено");
    }

    if (!permissionService.isDeletable(message, user))  {
      throw new AccessViolationException("Вы не можете удалить это сообщение");
    }

    topicService.deleteWithBonus(message, user, reason, bonus);
    logger.info("Удалено сообщение " + msgid + " пользователем " + user.getNick() + " по причине `" + reason + '\'');
View Full Code Here

    @RequestParam int msgid
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isModeratorSession()) {
      throw new AccessViolationException("Not authorized");
    }

    Topic message = messageDao.getById(msgid);

    checkUndeletable(message);
View Full Code Here

    @RequestParam int msgid
  ) throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isModeratorSession()) {
      throw new AccessViolationException("Not authorized");
    }

    Topic message = messageDao.getById(msgid);

    checkUndeletable(message);
View Full Code Here

TOP

Related Classes of ru.org.linux.auth.AccessViolationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.