Package org.apdplat.module.security.model

Examples of org.apdplat.module.security.model.Role


     */
    @Override
    public void prepareForDelete(Integer[] ids){
        User loginUser=UserHolder.getCurrentLoginUser();
        for(int id :ids){
            Role role=getService().retrieve(Role.class, id);           
            boolean canDel=true;
            //获取拥有等待删除的角色的所有用户
            List<User> users=role.getUsers();
            for(User user : users){               
                if(PropertyHolder.getBooleanProperty("demo")){
                    if(user.getUsername().equals("admin")){
                        throw new RuntimeException("演示版本不能删除admin用户拥有的角色");
                    }
View Full Code Here


        roles=new ArrayList<>();
        for(String id :ids){
            String[] attr=id.split("-");
            if(attr.length==2){
                if("role".equals(attr[0])){
                    Role role=getService().retrieve(Role.class, Integer.parseInt(attr[1]));
                    roles.add(role);
                }
            }
        }  
    }   
View Full Code Here

            ids.addAll(getChildIds(item));
        }
        return ids;
    }
    public static boolean isParentOf(Role parent,Role child){
        Role role=child.getParent();
        while(role!=null){
            if(role.getId()==parent.getId()){
                return true;
            }
            role=role.getParent();
        }
        return false;
    }
View Full Code Here

        }
        return false;
    }
   
    public String toRootJson(boolean recursion){
        Role rootRole=getRootRole();
        if(rootRole==null){
            LOG.error("获取根角色失败!");
            return "";
        }
        StringBuilder json=new StringBuilder();
        json.append("[");

        json.append("{'text':'")
            .append(rootRole.getRoleName())
            .append("','id':'role-")
            .append(rootRole.getId());
            if(rootRole.getChild().isEmpty()){
                json.append("','leaf':true,'cls':'file'");
            }else{
                json.append("','leaf':false,'cls':'folder'");
               
                if (recursion) {
                    for(Role item : rootRole.getChild()){
                        json.append(",children:").append(toJson(item.getId(), recursion));
                    }
                }
            }
        json.append("}");
View Full Code Here

        json.append("]");
       
        return json.toString();
    }
    public String toJson(int roleId, boolean recursion){
        Role role=serviceFacade.retrieve(Role.class, roleId);
        if(role==null){
            LOG.error("获取ID为 "+roleId+" 的角色失败!");
            return "";
        }
        List<Role> child=role.getChild();
        if(child.isEmpty()){
            return "";
        }
        StringBuilder json=new StringBuilder();
        json.append("[");
View Full Code Here

        }
        if(len < 1){
            len = 10;
        }
        Org org = null;
        Role role = null;
        if(orgId > 0){
            //返回特定组织架构及其所有子机构的在线用户
            org = serviceFacade.retrieve(Org.class, orgId);
        }
        if(roleId > 0){
View Full Code Here

            String[] roleIds = roles.trim().split(",");
            for(String id : roleIds){
                String[] attr = id.split("-");
                if(attr.length == 2){
                    int roleId = Integer.parseInt(attr[1]);
                    Role temp = serviceFacade.retrieve(Role.class, roleId);
                    if(temp != null){
                        model.addRole(temp);
                        LOG.debug("角色 " + roleId + " 解析成功");
                    }
                }
View Full Code Here

TOP

Related Classes of org.apdplat.module.security.model.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.