Package com.mossle.auth.domain

Examples of com.mossle.auth.domain.Access


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

        List<Perm> perms = permManager.findBy("scopeId",
                ScopeHolder.getScopeId());
View Full Code Here


    @RequestMapping("access-save")
    public String save(@ModelAttribute Access access,
            @RequestParam("permId") Long permId,
            RedirectAttributes redirectAttributes) {
        // copy
        Access dest = null;

        Long id = access.getId();

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

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

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

        // save
        accessManager.save(dest);
View Full Code Here

                continue;
            }

            priority += PRIORITY_STEP;

            Access access = new Access();
            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

            if (value.trim().length() == 0) {
                continue;
            }

            Access access = createOrGetAccess(idStr, value, type, permStr,
                    scopeId);

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

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

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

        }
    }

    public Access createOrGetAccess(String id, String value, String type,
            String perm, String scopeId) {
        Access access;

        if (id.length() != 0) {
            access = this.get(Long.parseLong(id));
        } else {
            access = this.findUnique(
                    "from Access where value=? and type=? and scope_id=?",
                    value, type, scopeId);
        }

        if (access == null) {
            access = new Access();
            access.setType(type);
            access.setValue(value);
            access.setScopeId(scopeId);
            this.save(access);
        }

        return access;
    }
View Full Code Here

TOP

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

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.