Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于AuthDemo中项目不能直接运行,需修改如下: #7

Open
alpha1203 opened this issue Dec 10, 2013 · 1 comment
Open

Comments

@alpha1203
Copy link

1>TestModule .java需加上一行代码,@authority(value="B001",desc="操作方法")

package org.nutz.authdemo.web.module;

import java.util.Date;

import org.nutz.extras.mvc.annotation.Authority;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;

@at("/test")
public class TestModule {

@At("/ping")
@Ok("json")
@Authority(value="B001",desc="操作方法")
public String ping(){
    return new Date().toString();
}

}

2>在用户登录完之后把该权限加进去
AuthDemoModule.java中修改如下。

@At("/login")
@Ok("jsp:jsp.login")
@Authority(value="A003",isDefault=true,desc="登录")
public void login(HttpServletRequest req){
    //添加权限到session中,登录后就可以访问 index 和  logout 了.
    //登录之后把访问/test/ping 的方法权限加进来
    req.getSession().setAttribute("__AUTHORITY_STRING__", "A001;A002;B001;");
}
@wendal
Copy link
Member

wendal commented Dec 13, 2013

哦,好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants