在liferay中添加resourcepermission

u5rb5r59  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(214)

我正在尝试添加多个资源权限。

for(int jndex = 0; jndex < rowIds.length; jndex ++) {

        if(rowIds[jndex] > 0) {

            ResourceAction resourceAction = ResourceActionLocalServiceUtil
            .fetchResourceAction(rowIds[jndex]);
            String className = resourceAction.getName();
            long classNameId = ClassNameLocalServiceUtil
                            .getClassNameId(className);

            ResourcePermissionLocalServiceUtil.addResourcePermission(
                serviceContext.getCompanyId(), 
                className, ResourceConstants.SCOPE_GROUP, 
                String.valueOf(classNameId), 
                role.getRoleId(), resourceAction.getActionId()
                );

            _log.info("rowIds[jndex]  " + rowIds[jndex] +
                " resourceAction.getActionId() " + resourceAction.getActionId());
        }
    }

当rowids的长度大于1时。它只需向数据库添加一个资源权限。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题