Package org.wso2.carbon.user.core

Examples of org.wso2.carbon.user.core.AuthorizationManager.authorizeRole()


            AuthorizationManager authMan = realm.getAuthorizationManager();
            // Authorize the admin role, if not authorized yet.
            if (!authMan.isRoleAuthorized(adminRole,
                                          CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION,
                                          UserMgtConstants.EXECUTE_ACTION)) {
                authMan.authorizeRole(adminRole, CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION,
                                      UserMgtConstants.EXECUTE_ACTION);
            }
        } catch (UserStoreException e) {
            String msg = "Error in authorizing the admin role.";
            log.error(msg, e);
View Full Code Here


        try {
            AuthorizationManager accessControlAdmin = userRealm.getAuthorizationManager();
            String everyoneRole = CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME;

            accessControlAdmin.authorizeRole(everyoneRole, path, ActionConstants.GET);
            accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.PUT);
            accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.DELETE);
            accessControlAdmin.denyRole(everyoneRole, path, AccessControlConstants.AUTHORIZE);

        } catch (UserStoreException e) {
View Full Code Here

            userStoreManager.addRole("tracker_role", new String[] {"tracker"}, permisions);
        }
        userStoreManager.updateCredentialByAdmin("tracker", "tracker123");
        // do some authorizations
        AuthorizationManager authManager = realm.getAuthorizationManager();
        authManager.authorizeRole("tracker_role", "tracker_obj", "read");
    }
}
View Full Code Here

                }
            }

            if (acessibleRoles != null) {
                for (String acessibleRole : acessibleRoles) {
                    authorizationManager.authorizeRole(acessibleRole,
                            path, AUTH_WRITE_ACTION);
                }
            }
            log.info("share the topic "+topicName + " with "+ Arrays.toString(accessibleUsers) + ((acessibleRoles != null)?acessibleRoles:""));
            return "Sucess";
View Full Code Here

                    String action = permission[0];
                    String checked = permission[1];

                    if (action.equals("ra")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.authorizeRole(permRole, resourcePath, ActionConstants.GET);
                            notificationResponse += " READ: Allowed.";
                        }
                    } else if (action.equals("rd")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.denyRole(permRole, resourcePath, ActionConstants.GET);
View Full Code Here

                            accessControlAdmin.denyRole(permRole, resourcePath, ActionConstants.GET);
                            notificationResponse += " READ: Denied.";
                        }
                    } else if (action.equals("wa")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.authorizeRole(permRole, resourcePath, ActionConstants.PUT);
                            notificationResponse += " WRITE: Allowed.";
                        }
                    } else if (action.equals("wd")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.denyRole(permRole, resourcePath, ActionConstants.PUT);
View Full Code Here

                            accessControlAdmin.denyRole(permRole, resourcePath, ActionConstants.PUT);
                            notificationResponse += " WRITE: Denied.";
                        }
                    } else if (action.equals("da")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.authorizeRole(permRole, resourcePath, ActionConstants.DELETE);
                            notificationResponse += " DELETE: Allowed.";
                        }
                    } else if (action.equals("dd")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.denyRole(permRole, resourcePath, ActionConstants.DELETE);
View Full Code Here

                            accessControlAdmin.denyRole(permRole, resourcePath, ActionConstants.DELETE);
                            notificationResponse += " DELETE: Denied.";
                        }
                    } else if (action.equals("aa")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.authorizeRole(permRole, resourcePath, AccessControlConstants.AUTHORIZE);
                            notificationResponse += " AUTHORIZE: Allowed.";
                        }
                    } else if (action.equals("ad")) {
                        if (checked.equals("true")) {
                            accessControlAdmin.denyRole(permRole, resourcePath, AccessControlConstants.AUTHORIZE);
View Full Code Here

            Collection defaultGadgetCollection = registry.newCollection();

            // Set permission for annonymous read
            AuthorizationManager authorizationManager =
                    ThemePopulatorContext.getUserRealm().getAuthorizationManager();
            authorizationManager.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                    SYSTEM_DEFAULT_THEMES_PATH, ActionConstants.GET);

            /*authorizationManager.authorizeRole(RegistryConstants.GUESTS_ROLE,
                                             SYSTEM_GADGETS_PATH, ActionConstants.GET);*/

 
View Full Code Here

        AuthorizationManager authMan = realm.getAuthorizationManager();
        UserStoreManager usWriter = realm.getUserStoreManager();

        usWriter.addRole("rolex", new String[] { "saman", "amara" }, null);
        usWriter.addRole("roley", null, null);
        authMan.authorizeRole("rolex", "wall", "write");
        authMan.authorizeRole("roley", "table", "write");
       
        try {
          authMan.authorizeRole(null, "wall", "write");
          fail("Exception at authorizing a role with Null role");
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.