当前位置: 首页>>代码示例>>Java>>正文


Java UserStoreException.getMessage方法代码示例

本文整理汇总了Java中org.wso2.carbon.user.core.UserStoreException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java UserStoreException.getMessage方法的具体用法?Java UserStoreException.getMessage怎么用?Java UserStoreException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.user.core.UserStoreException的用法示例。


在下文中一共展示了UserStoreException.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAllowedRoleName

import org.wso2.carbon.user.core.UserStoreException; //导入方法依赖的package包/类
/**
 * @param roleName
 * @param realm
 * @return
 * @throws UserAdminException
 */
private boolean isAllowedRoleName(String roleName, UserRealm realm) throws UserAdminException {

    int index;
    index = roleName.indexOf("/");

    if (index > 0) {
        roleName = roleName.substring(index + 1);
    }

    try {
        return !realm.getRealmConfiguration().isReservedRoleName(roleName);
    } catch (UserStoreException e) {
        throw new UserAdminException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:UserAdmin.java

示例2: setRoleUIPermission

import org.wso2.carbon.user.core.UserStoreException; //导入方法依赖的package包/类
public void setRoleUIPermission(String roleName, String[] rawResources)
        throws UserAdminException {
    try {
        if (((AbstractUserStoreManager) realm.getUserStoreManager()).isOthersSharedRole(roleName)) {
            throw new UserAdminException("Logged in user is not authorized to assign " +
                    "permissions to a role belong to another tenant");
        }
        if (realm.getRealmConfiguration().getAdminRoleName().equalsIgnoreCase(roleName)) {
            String msg = "UI permissions of Admin is not allowed to change";
            log.error(msg);
            throw new UserAdminException(msg);
        }

        String loggedInUserName = addPrimaryDomainIfNotExists(getLoggedInUser());
        String adminUser = addPrimaryDomainIfNotExists(realm.getRealmConfiguration().getAdminUserName());
        if (rawResources != null &&
                !adminUser.equalsIgnoreCase(loggedInUserName)) {
            Arrays.sort(rawResources);
            if (Arrays.binarySearch(rawResources, PERMISSION_ADMIN) > -1 ||
                    Arrays.binarySearch(rawResources, "/permission/protected") > -1 ||
                    Arrays.binarySearch(rawResources, PERMISSION) > -1) {
                log.warn("An attempt to Assign admin permission for role by user : " +
                        loggedInUserName);
                throw new UserStoreException("Can not assign Admin for permission role");
            }
        }

        String[] optimizedList = UserCoreUtil.optimizePermissions(rawResources);
        AuthorizationManager authMan = realm.getAuthorizationManager();
        authMan.clearRoleActionOnAllResources(roleName, UserMgtConstants.EXECUTE_ACTION);
        for (String path : optimizedList) {
            authMan.authorizeRole(roleName, path, UserMgtConstants.EXECUTE_ACTION);
        }
    } catch (UserStoreException e) {
        log.error(e.getMessage(), e);
        throw new UserAdminException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:39,代码来源:UserRealmProxy.java

示例3: bulkImportUsers

import org.wso2.carbon.user.core.UserStoreException; //导入方法依赖的package包/类
public void bulkImportUsers(String userStoreDomain, String fileName, InputStream inStream, String defaultPassword)
        throws UserAdminException {
    try {
        BulkImportConfig config = new BulkImportConfig(inStream, fileName);
        if (defaultPassword != null && defaultPassword.trim().length() > 0) {
            config.setDefaultPassword(defaultPassword.trim());
        }
        if (StringUtils.isNotEmpty(userStoreDomain)) {
            config.setUserStoreDomain(userStoreDomain);
        }

        UserStoreManager userStore = this.realm.getUserStoreManager();
        userStore = userStore.getSecondaryUserStoreManager(userStoreDomain);

        if (fileName.endsWith("csv")) {
            CSVUserBulkImport csvAdder = new CSVUserBulkImport(config);
            csvAdder.addUserList(userStore);
        } else if (fileName.endsWith("xls") || fileName.endsWith("xlsx")) {
            ExcelUserBulkImport excelAdder = new ExcelUserBulkImport(config);
            excelAdder.addUserList(userStore);
        } else {
            throw new UserAdminException("Unsupported format");
        }
    } catch (UserStoreException e) {
        // previously logged so logging not needed
        throw new UserAdminException(e.getMessage(), e);
    }

}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:30,代码来源:UserRealmProxy.java

示例4: isReadOnlyUserStore

import org.wso2.carbon.user.core.UserStoreException; //导入方法依赖的package包/类
public boolean isReadOnlyUserStore() throws UserProfileException {
    try {
        UserRealm realm = getUserRealm();
        if ("true".equals(realm.getRealmConfiguration().getUserStoreProperty(
                UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY))) {
            return true;
        }
        return false;
    } catch (UserStoreException e) {
        log.error(e.getMessage(), e);
        throw new UserProfileException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:14,代码来源:UserProfileAdmin.java


注:本文中的org.wso2.carbon.user.core.UserStoreException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。