From: Kai Moritz Date: Mon, 1 Feb 2016 17:25:48 +0000 (+0100) Subject: Added a controller, to manage permissions X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=2e34ba96c79aa0da75e33a60201a681bb7cfde0e;p=examples%2Ffacebook-app Added a controller, to manage permissions --- 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
    +
    + + +
    + +