Liferay Dynamic Data Mapping API provides comprehensive APIs for creating, managing, and processing dynamic forms and data structures within Liferay Portal.
—
Permission system, access control, data validation framework, and security policy enforcement.
interface DDMPermissionSupport {
String getResourceName(String className);
boolean contains(PermissionChecker permissionChecker, String name,
long primaryKey, String actionId) throws PortalException;
}
interface DDMStructurePermission {
static void check(PermissionChecker permissionChecker, DDMStructure structure, String actionId)
throws PortalException;
static boolean contains(PermissionChecker permissionChecker, DDMStructure structure, String actionId);
}
interface DDMTemplatePermission {
static void check(PermissionChecker permissionChecker, DDMTemplate template, String actionId)
throws PortalException;
static boolean contains(PermissionChecker permissionChecker, DDMTemplate template, String actionId);
}interface DDMValidator {
void validate(DDMValidatorValidateRequest ddmValidatorValidateRequest)
throws DDMValidatorException;
}
class DDMValidatorValidateRequest {
DDMFormValues getDDMFormValues();
Locale getLocale();
ServiceContext getServiceContext();
}
class DDMValidatorException extends PortalException {
DDMValidatorException(String msg);
Map<String, List<String>> getErrors();
}@Component
public class SecurityExample {
public void checkPermissions(PermissionChecker permissionChecker,
DDMStructure structure) throws PortalException {
// Check if user can view the structure
DDMStructurePermission.check(permissionChecker, structure, ActionKeys.VIEW);
// Check if user can update the structure
if (DDMStructurePermission.contains(permissionChecker, structure, ActionKeys.UPDATE)) {
// User has update permission
System.out.println("User can update structure");
}
}
}Install with Tessl CLI
npx tessl i tessl/maven-com-liferay--com-liferay-dynamic-data-mapping-api