From a3c19a140b586c1fe442aec45b2d4f9238405adb Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 1 Feb 2016 18:29:09 +0100 Subject: [PATCH] Added a controller, that lists the pages, the user is an adminitrator of --- .../de/juplo/yourshouter/PagesController.java | 39 +++++++++++++++++++ src/main/webapp/thymeleaf/home.html | 1 + src/main/webapp/thymeleaf/pages.html | 20 ++++++++++ 3 files changed, 60 insertions(+) create mode 100644 src/main/java/de/juplo/yourshouter/PagesController.java create mode 100644 src/main/webapp/thymeleaf/pages.html diff --git a/src/main/java/de/juplo/yourshouter/PagesController.java b/src/main/java/de/juplo/yourshouter/PagesController.java new file mode 100644 index 0000000..f7091fb --- /dev/null +++ b/src/main/java/de/juplo/yourshouter/PagesController.java @@ -0,0 +1,39 @@ +package de.juplo.yourshouter; + +import javax.inject.Inject; +import org.springframework.social.facebook.api.Account; + +import org.springframework.social.facebook.api.Facebook; +import org.springframework.social.facebook.api.PagedList; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + + +/** + * Controller, that handles requests to the root of the application. + * + * @author Kai Moritz + */ +@Controller +public class PagesController +{ + private final Facebook facebook; + + + @Inject + public PagesController(Facebook facebook) + { + this.facebook = facebook; + } + + + @RequestMapping(value = "/pages.html", method = RequestMethod.GET) + public String list(Model model) + { + PagedList accounts = facebook.pageOperations().getAccounts(); + model.addAttribute("accounts", accounts); + return "pages"; + } +} diff --git a/src/main/webapp/thymeleaf/home.html b/src/main/webapp/thymeleaf/home.html index b9d94f9..891da6c 100644 --- a/src/main/webapp/thymeleaf/home.html +++ b/src/main/webapp/thymeleaf/home.html @@ -10,6 +10,7 @@
  • Show public profile-data
  • Connect to the H2-console
  • Manage permissions
  • +
  • Show pages, that you are an administrator of
  • diff --git a/src/main/webapp/thymeleaf/pages.html b/src/main/webapp/thymeleaf/pages.html new file mode 100644 index 0000000..5e8532a --- /dev/null +++ b/src/main/webapp/thymeleaf/pages.html @@ -0,0 +1,20 @@ + + + + Pages + + +

    Back HOME

    +
    +

    The permissions you granted to this app

    + +

    Pages, you are an administrator of

    + + + -- 2.20.1