From 2e34ba96c79aa0da75e33a60201a681bb7cfde0e Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 1 Feb 2016 18:25:48 +0100 Subject: [PATCH] Added a controller, to manage permissions --- .../yourshouter/PermissionsController.java | 39 +++++++++++++++++++ src/main/webapp/thymeleaf/home.html | 1 + src/main/webapp/thymeleaf/permissions.html | 29 ++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 src/main/java/de/juplo/yourshouter/PermissionsController.java create mode 100644 src/main/webapp/thymeleaf/permissions.html diff --git a/src/main/java/de/juplo/yourshouter/PermissionsController.java b/src/main/java/de/juplo/yourshouter/PermissionsController.java new file mode 100644 index 0000000..1ce9c1d --- /dev/null +++ b/src/main/java/de/juplo/yourshouter/PermissionsController.java @@ -0,0 +1,39 @@ +package de.juplo.yourshouter; + +import java.util.List; +import javax.inject.Inject; + +import org.springframework.social.facebook.api.Facebook; +import org.springframework.social.facebook.api.Permission; +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 PermissionsController +{ + private final Facebook facebook; + + + @Inject + public PermissionsController(Facebook facebook) + { + this.facebook = facebook; + } + + + @RequestMapping(value = "/permissions.html", method = RequestMethod.GET) + public String list(Model model) + { + List permissions = facebook.userOperations().getUserPermissions(); + model.addAttribute("permissions", permissions); + return "permissions"; + } +} diff --git a/src/main/webapp/thymeleaf/home.html b/src/main/webapp/thymeleaf/home.html index f7649e5..b9d94f9 100644 --- a/src/main/webapp/thymeleaf/home.html +++ b/src/main/webapp/thymeleaf/home.html @@ -9,6 +9,7 @@
  • Show connection-status
  • Show public profile-data
  • Connect to the H2-console
  • +
  • Manage permissions
  • diff --git a/src/main/webapp/thymeleaf/permissions.html b/src/main/webapp/thymeleaf/permissions.html new file mode 100644 index 0000000..2afd746 --- /dev/null +++ b/src/main/webapp/thymeleaf/permissions.html @@ -0,0 +1,29 @@ + + + + Manage Permissions + + +

    Back HOME

    +
    +

    Manage Permissions

    + + + + + + + + + + + + + +
    NameStatusGrantedDecliend
    public_profilegrantedtruefalse
    +
    + + +
    + + -- 2.20.1