Package com.mossle.auth.domain

Examples of com.mossle.auth.domain.Perm


    @RequestMapping("perm-input")
    public String input(@RequestParam(value = "id", required = false) Long id,
            Model model) {
        if (id != null) {
            Perm perm = permManager.get(id);
            model.addAttribute("model", perm);
        }

        List<PermType> permTypes = permTypeManager.findBy("scopeId",
                ScopeHolder.getScopeId());
View Full Code Here


    @RequestMapping("perm-save")
    public String save(@ModelAttribute Perm perm,
            @RequestParam("permTypeId") Long permTypeId,
            RedirectAttributes redirectAttributes) {
        Perm dest = null;
        Long id = perm.getId();

        if (id != null) {
            dest = permManager.get(id);
            beanMapper.copy(perm, dest);
        } else {
            dest = perm;
        }

        if (id == null) {
            dest.setScopeId(ScopeHolder.getScopeId());
        }

        dest.setPermType(permTypeManager.get(permTypeId));
        permManager.save(dest);

        messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
                "保存成功");
View Full Code Here

    public void onApplicationEvent(EntityEvent event) {
        if (!event.supportsEntityType(Perm.class)) {
            return;
        }

        Perm perm = event.getEntity();
        authCache.evictPerm(perm);
    }
View Full Code Here

        } else {
            dest = access;
        }

        // foreign
        Perm perm = permManager.get(permId);
        dest.setPerm(perm);

        if (id == null) {
            dest.setScopeId(ScopeHolder.getScopeId());
        }
View Full Code Here

            RoleDef roleDef = role.getRoleDef();
            roleDefChecker.check(roleDef);
            roleDef.getPerms().clear();

            for (Long permId : selectedItem) {
                Perm perm = permManager.get(permId);
                roleDef.getPerms().add(perm);
            }

            roleDefManager.save(roleDef);
            messageHelper.addFlashMessage(redirectAttributes,
View Full Code Here

                String code = array[0];
                String name = array[1];
                String type = array[2];

                Perm perm = permManager.findUnique(
                        "from Perm where code=? and scopeId=?", code,
                        ScopeHolder.getScopeId());
                PermType permType = permTypeManager.findUniqueBy("name", type);

                if (permType == null) {
                    permType = new PermType();
                    permType.setName(type);
                    permType.setType(0);
                    permType.setScopeId(ScopeHolder.getScopeId());
                    permTypeManager.save(permType);
                }

                if (perm == null) {
                    perm = new Perm();
                    perm.setCode(code);
                    perm.setName(name);
                    perm.setPermType(permType);
                    perm.setScopeId(ScopeHolder.getScopeId());
                    permManager.save(perm);
                }
            }
        }
View Full Code Here

            access.setValue(value);
            access.setScopeId(scopeId);
            access.setType(type);
            access.setPriority(priority);

            Perm perm = permManager.findUnique(
                    "from Perm where code=? and scopeId=?", permStr, scopeId);
            Assert.notNull(perm, "cannot find perm");
            access.setPerm(perm);
            accessManager.save(access);
        }
View Full Code Here

                    scopeId);

            priority += PRIORITY_STEP;
            access.setPriority(priority);

            Perm perm = this.createOrGetPerm(permStr, scopeId);
            access.setPerm(perm);

            this.save(access);
        }
    }
View Full Code Here

        return access;
    }

    public Perm createOrGetPerm(String code, String scopeId) {
        Perm perm = this.findUnique("from Perm where code=? and scope_id=?",
                code, scopeId);

        if (perm == null) {
            perm = new Perm();
            perm.setCode(code);
            perm.setName(code);
            perm.setScopeId(scopeId);
            this.save(perm);
        }

        return perm;
    }
View Full Code Here

TOP

Related Classes of com.mossle.auth.domain.Perm

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.