Interface InlineSQLHelper
@ProviderType
public interface InlineSQLHelper
Provides utility methods for filtering SQL queries by the user's permissions.
- Author:
- Raymond Augé
-
Method Summary
Modifier and TypeMethodDescription<T extends com.liferay.petra.sql.dsl.Table<T>>
com.liferay.petra.sql.dsl.expression.PredicategetPermissionWherePredicate
(Class<?> modelClass, com.liferay.petra.sql.dsl.Column<T, Long> classPKColumn, long... groupIds) <T extends com.liferay.petra.sql.dsl.Table<T>>
com.liferay.petra.sql.dsl.expression.PredicategetPermissionWherePredicate
(String modelClassName, com.liferay.petra.sql.dsl.Column<T, Long> classPKColumn, long... groupIds) boolean
Returnstrue
if the inline SQL helper is enabled.boolean
isEnabled
(long groupId) Returnstrue
if the inline SQL helper is enabled for the group.boolean
isEnabled
(long[] groupIds) Returnstrue
if the inline SQL helper is enabled for the groups.boolean
isEnabled
(long companyId, long groupId) Returnstrue
if the inline SQL helper is enabled for the company or group.<T extends com.liferay.petra.sql.dsl.Table<T>>
com.liferay.petra.sql.dsl.query.DSLQueryreplacePermissionCheck
(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery, Class<?> modelClass, com.liferay.petra.sql.dsl.Column<T, Long> classPKColumn, long... groupIds) replacePermissionCheck
(String sql, String className, String classPKField) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, long groupId) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, long[] groupIds) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, long[] groupIds, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, long groupId, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField, long groupId) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField, long[] groupIds) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField, long[] groupIds, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField, long groupId, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view.replacePermissionCheck
(String sql, String className, String classPKField, String userIdField, String groupIdField, long[] groupIds, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view.
-
Method Details
-
getPermissionWherePredicate
-
getPermissionWherePredicate
-
isEnabled
boolean isEnabled()Returnstrue
if the inline SQL helper is enabled.- Returns:
true
if the inline SQL helper is enabled;false
otherwise
-
isEnabled
boolean isEnabled(long groupId) Returnstrue
if the inline SQL helper is enabled for the group.- Parameters:
groupId
- the primary key of the group- Returns:
true
if the inline SQL helper is enabled for the group;false
otherwise
-
isEnabled
boolean isEnabled(long companyId, long groupId) Returnstrue
if the inline SQL helper is enabled for the company or group.- Parameters:
companyId
- the primary key of the companygroupId
- the primary key of the group- Returns:
true
if the inline SQL helper is enabled for the company or group;false
otherwise
-
isEnabled
boolean isEnabled(long[] groupIds) Returnstrue
if the inline SQL helper is enabled for the groups.- Parameters:
groupIds
- the primary keys of the groups- Returns:
true
if the inline SQL helper is enabled for the groups;false
otherwise
-
replacePermissionCheck
-
replacePermissionCheck
Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary key- Returns:
- the modified SQL query
-
replacePermissionCheck
Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keygroupId
- the primary key of the group containing the resources (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, long groupId, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keygroupId
- the primary key of the group containing the resources (optionallynull
)bridgeJoin
- an additional join clause to insert before the permission join (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keygroupIds
- the primary keys of the groups containing the resources (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, long[] groupIds, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keygroupIds
- the primary keys of the groups containing the resources (optionallynull
)bridgeJoin
- an additional join clause to insert before the permission join (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField, long groupId) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)groupId
- the primary key of the group containing the resources (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField, long groupId, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)groupId
- the primary key of the group containing the resources (optionallynull
)bridgeJoin
- an additional join clause to insert before the permission join (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField, long[] groupIds) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)groupIds
- the primary keys of the groups containing the resources (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField, long[] groupIds, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)groupIds
- the primary keys of the groups containing the resources (optionallynull
)bridgeJoin
- an additional join clause to insert before the permission join (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)bridgeJoin
- an additional join clause to insert before the permission join (optionallynull
)- Returns:
- the modified SQL query
-
replacePermissionCheck
String replacePermissionCheck(String sql, String className, String classPKField, String userIdField, String groupIdField, long[] groupIds, String bridgeJoin) Modifies the SQL query to only match resources that the user has permission to view. Note that this method is only intended for use with relatively simple SQL queries (i.e. queries that have no more than one WHERE clause). For more complex SQL queries, it is recommended to use the DSLQuery methods instead.- Parameters:
sql
- the SQL queryclassName
- the fully qualified class name of the resources matched by the queryclassPKField
- the name of the column containing the resource's primary keyuserIdField
- the name of the column containing the resource owner's primary key (optionallynull
)groupIdField
- the name of the column containing the resource's group ID (optionallynull
)groupIds
- the primary keys of the groups containing the resources (optionallynull
)bridgeJoin
- an additional join clause to insert before the permission join (optionallynull
)- Returns:
- the modified SQL query
-