Package org.apache.roller.weblogger.business

Examples of org.apache.roller.weblogger.business.UserManager.checkPermission()


    public boolean isUserIsAdmin() {
        try {
            GlobalPermission adminPerm = new GlobalPermission(
                Collections.singletonList(GlobalPermission.ADMIN));
            UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
            return umgr.checkPermission(adminPerm, getAuthenticatedUser());
        } catch (Exception e) {}
        return false;
    }
   
   
View Full Code Here


    public boolean isUserIsAdmin() {
        try {
            GlobalPermission adminPerm = new GlobalPermission(
                Collections.singletonList(GlobalPermission.ADMIN));
            UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
            return umgr.checkPermission(adminPerm, getAuthenticatedUser());
        } catch (Exception e) {}
        return false;
    }
   
   
View Full Code Here

        log.info("BEGIN");
      
        WeblogPermission perm =
            new WeblogPermission(testWeblog, testUser, WeblogPermission.POST);
        UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
        assertTrue(umgr.checkPermission(perm, testUser));
       
        // we need a second user for this test
        User adminUser = TestUtils.setupUser("adminUser");
        umgr.grantRole("admin", adminUser);
        TestUtils.endSession(true);
View Full Code Here

        TestUtils.endSession(true);

        // because adminUser is a global admin, they should have POST perm
        WeblogPermission perm2 =
            new WeblogPermission(testWeblog, testUser, WeblogPermission.POST);
        assertTrue(umgr.checkPermission(perm, testUser));
       
        log.info("END");
    }
}
View Full Code Here

            }
           
            // if user is an admin then apply pinned to main value as well
            GlobalPermission adminPerm =
                new GlobalPermission(Collections.singletonList(GlobalPermission.ADMIN));
            if (userMgr.checkPermission(adminPerm, getAuthenticatedUser())) {
                entry.setPinnedToMain(getBean().getPinnedToMain());
            }
           
            if(!StringUtils.isEmpty(getBean().getEnclosureURL())) try {
                // Fetch MediaCast resource
View Full Code Here

                if (configTab.getGlobalPermissionActions() != null
                        && !configTab.getGlobalPermissionActions().isEmpty()) {
                    try {
                        GlobalPermission perm =
                            new GlobalPermission(configTab.getGlobalPermissionActions());
                        if (!umgr.checkPermission(perm, user)) {
                            includeTab = false;
                        }
                    } catch (WebloggerException ex) {
                        log.debug("ERROR: fetching user roles", ex);
                        includeTab = false;
View Full Code Here

                // weblog permissions check
                if (configTab.getWeblogPermissionActions() != null
                        && !configTab.getWeblogPermissionActions().isEmpty()) {
                    WeblogPermission perm =
                        new WeblogPermission(weblog, configTab.getWeblogPermissionActions());
                    includeTab = umgr.checkPermission(perm, user);
                }
            }
           
            if (includeTab) {
                log.debug("tab allowed - "+configTab.getName());
View Full Code Here

                        // user roles check
                        if (configTabItem.getGlobalPermissionActions() != null
                                && !configTabItem.getGlobalPermissionActions().isEmpty()) {
                            GlobalPermission perm =
                                new GlobalPermission(configTabItem.getGlobalPermissionActions());
                            if (!umgr.checkPermission(perm, user)) {
                                includeItem = false;
                            }
                        }
                    }
                   
View Full Code Here

                    if (includeItem) {
                        // weblog permissions check
                        if (configTabItem.getWeblogPermissionActions() != null
                                && !configTabItem.getWeblogPermissionActions().isEmpty()) {
                            WeblogPermission perm = new WeblogPermission(weblog, configTabItem.getWeblogPermissionActions());
                            includeItem = umgr.checkPermission(perm, user);
                        }
                    }
                   
                    if (includeItem) {
                        log.debug("tab item allowed - "+configTabItem.getName());
View Full Code Here

               
                // are we also enforcing global permissions?
                if (theAction.requiredGlobalPermissionActions() != null
                        && !theAction.requiredGlobalPermissionActions().isEmpty()) {
                    GlobalPermission perm = new GlobalPermission(theAction.requiredGlobalPermissionActions());
                    if (!umgr.checkPermission(perm, authenticatedUser)) {
                        log.debug("DENIED: user does not have permission = " + perm.toString());
                        return "access-denied";
                    }
                }
               
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.