5 changed files with 89 additions and 3 deletions
@ -0,0 +1,39 @@
|
||||
package com.fr.plugin.demo.web.request.handler; |
||||
|
||||
import com.fanruan.api.web.FlushKit; |
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
/** |
||||
* @author Elijah |
||||
* @version 10.0.4 |
||||
* Created by Elijah on 2019/11/15 |
||||
*/ |
||||
public class AdminHttpHandler extends BaseHttpHandler { |
||||
@Override |
||||
public RequestMethod getMethod() { |
||||
return RequestMethod.GET; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return "/demo/admin"; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isPublic() { |
||||
return false; |
||||
} |
||||
|
||||
public boolean needAdmin() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { |
||||
FlushKit.printAsString(httpServletResponse, "这是个只有超管能访问的接口"); |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.plugin.demo.web.request.handler; |
||||
|
||||
import com.fanruan.api.decision.AuthorityKit; |
||||
import com.fanruan.api.web.FlushKit; |
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
/** |
||||
* @author Elijah |
||||
* @version 10.0.4 |
||||
* Created by Elijah on 2019/11/15 |
||||
*/ |
||||
public class ModuleHttpHandler extends BaseHttpHandler { |
||||
@Override |
||||
public RequestMethod getMethod() { |
||||
return RequestMethod.GET; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return "/demo/module"; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isPublic() { |
||||
return false; |
||||
} |
||||
|
||||
public String[] modules() { |
||||
return new String[] {AuthorityKit.Management.USER}; |
||||
} |
||||
|
||||
@Override |
||||
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse response) throws Exception { |
||||
FlushKit.printAsString(response, "这是个有用户管理权限的次管才能访问的接口"); |
||||
} |
||||
} |
Loading…
Reference in new issue