// TODO сделать более гибкую систему управления словами
  @RequestMapping(value = "/words/{languageId}")
  public String getWords(HttpServletRequest request, Model model, @PathVariable int languageId) {
    PageContext PC = new PageContext(request, model);
    UserSecurity me = PC.getUser();
    AccessManager manager;

    if (me == null
        || (manager = me.getAccessManager()) == null
        || !manager.has("LANGUAGES", "UPDATE_VALUES"))
      return "redirect:/" + ManagerGenerator.MAIN_PAGE;

    ClientPage page = new ClientPage();
    page.setTitle("Управление словами");
    PC.setClientPage(page).setUrl(new Url(request));

    if (!PC.hasError()) {
      Language language = Languages.getLanguage(languageId);

      model.addAttribute("language", language);
      model.addAttribute("keys", Languages.getKeys());
      PC.setView("languages", "words");
    } else PC.setView("main", "access");

    return PC.render(PageContext.RENDER_BACKEND);
  }
  @RequestMapping(value = "/create")
  public String createLanguage(HttpServletRequest request, Model model) {
    PageContext PC = PageContext.newInstance(request, model);
    UserSecurity me = PC.getUser();
    AccessManager manager;

    if (me == null || (manager = me.getAccessManager()) == null || !manager.has("LANGUAGE", "ADD"))
      PC.addError(AccessErrors._NAME, AccessErrors.NOT_HAS_PERMISSIONS);

    PC.initPage("Создание языка", null, null);

    if (!PC.hasError()) {
      model.addAttribute("language", new Language());
      PC.setView("languages", "createEdit");
    } else PC.setView("main", "access");

    return PC.render(PageContext.RENDER_BACKEND);
  }
  @RequestMapping
  public String getLanguageList(HttpServletRequest request, Model model) {
    PageContext PC = PageContext.newInstance(request, model);
    UserSecurity me = PC.getUser();
    AccessManager manager;

    if (me == null || (manager = me.getAccessManager()) == null || !manager.hasAny("LANGUAGE"))
      PC.addError(AccessErrors._NAME, AccessErrors.NOT_HAS_PERMISSIONS);

    PC.initPage("Управление языками", null, null);

    if (!PC.hasError()) {
      model.addAttribute("languages", Languages.getLanguages());
      PC.setView("languages", "list");
    } else PC.setView("main", "access");

    return PC.render(PageContext.RENDER_BACKEND);
  }