Search in sources :

Example 1 with SysUser

use of com.cdeledu.model.rbac.SysUser in project wechat by dllwh.

the class ShiroServiceImpl method check.

@Override
public boolean check(Object[] permissions) {
    SysUser user = ShiroHelper.getPrincipal();
    if (user == null) {
        return false;
    }
    String join = StringUtils.join(permissions, ShiroHelper.NAMES_DELIMETER);
    if (ShiroHelper.hasAnyRole(join)) {
        return true;
    }
    return false;
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser)

Example 2 with SysUser

use of com.cdeledu.model.rbac.SysUser in project wechat by dllwh.

the class ShiroServiceImpl method checkAll.

@Override
public boolean checkAll() {
    SysUser user = ShiroHelper.getPrincipal();
    if (user == null) {
        return false;
    }
    String requestURI = ShiroHelper.getAccessAddress(WebUtilHelper.getHttpServletRequest());
    if (ShiroHelper.hasPermission(requestURI)) {
        return true;
    }
    return false;
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser)

Example 3 with SysUser

use of com.cdeledu.model.rbac.SysUser in project wechat by dllwh.

the class ManagerUserServiceImpl method delete.

/**
 * 删除用户
 */
@Override
@Transactional(readOnly = false)
public Integer delete(Object record) throws Exception {
    SysUser sysUser = new SysUser();
    sysUser.setId((Integer) record);
    sysUser.setIfEnabled(0);
    return baseDao.update(PREFIX + "updateByPrimaryKey", sysUser);
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with SysUser

use of com.cdeledu.model.rbac.SysUser in project wechat by dllwh.

the class ManagerUserServiceImpl method checkUserExits.

/**
 * 检查用户是否存在
 */
@Override
@Transactional(readOnly = true)
public SysUser checkUserExits(String userName, String passWord) throws Exception {
    SysUser managerUser = new SysUser();
    managerUser.setUserName(userName);
    managerUser.setPassword(passWord);
    return checkUserExits(managerUser);
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with SysUser

use of com.cdeledu.model.rbac.SysUser in project wechat by dllwh.

the class LoginController method kickout.

/**
 * @方法:用户被提出\被挤掉
 * @创建人:独泪了无痕
 * @return
 */
@RequestMapping(params = "kickout")
public String kickout(HttpServletRequest request) {
    SysUser currenLoginUser = ShiroHelper.getPrincipal();
    // 判断用户是否为空,不为空,则清空session中的用户object
    if (currenLoginUser != null) {
        HttpSession session = request.getSession();
        session.removeAttribute(GlobalConstants.USER_SESSION);
        ShiroHelper.logout();
    }
    return FilterHelper.LOGIN_SHORT;
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser) HttpSession(javax.servlet.http.HttpSession) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SysUser (com.cdeledu.model.rbac.SysUser)21 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 AjaxJson (com.cdeledu.common.base.AjaxJson)8 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)8 SystemLog (com.cdeledu.core.annotation.SystemLog)7 SysUserRole (com.cdeledu.model.rbac.SysUserRole)4 HttpSession (javax.servlet.http.HttpSession)3 AuthenticationException (org.apache.shiro.authc.AuthenticationException)2 DisabledAccountException (org.apache.shiro.authc.DisabledAccountException)2 ExcessiveAttemptsException (org.apache.shiro.authc.ExcessiveAttemptsException)2 LockedAccountException (org.apache.shiro.authc.LockedAccountException)2 UnknownAccountException (org.apache.shiro.authc.UnknownAccountException)2 Transactional (org.springframework.transaction.annotation.Transactional)2 OnlineUser (com.cdeledu.model.system.OnlineUser)1 HashMap (java.util.HashMap)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 SimpleAuthenticationInfo (org.apache.shiro.authc.SimpleAuthenticationInfo)1 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)1 SimpleAuthorizationInfo (org.apache.shiro.authz.SimpleAuthorizationInfo)1 SimplePrincipalCollection (org.apache.shiro.subject.SimplePrincipalCollection)1