本文整理汇总了Java中com.liferay.portal.kernel.security.permission.ActionKeys类的典型用法代码示例。如果您正苦于以下问题:Java ActionKeys类的具体用法?Java ActionKeys怎么用?Java ActionKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionKeys类属于com.liferay.portal.kernel.security.permission包,在下文中一共展示了ActionKeys类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setFolderPermissions
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFolderPermissions(Folder folder) throws Exception{
ResourcePermission resourcePermission = null;
final Role guestMemberRole = RoleLocalServiceUtil.getRole(folder.getCompanyId(), RoleConstants.GUEST);
final Role siteMemberRole = RoleLocalServiceUtil.getRole(folder.getCompanyId(), RoleConstants.SITE_MEMBER);
ResourceAction resourceAction = ResourceActionLocalServiceUtil.getResourceAction(DLFolder.class.getName(), ActionKeys.VIEW);
String[] actionIdsGuest = new String[] { ActionKeys.VIEW, ActionKeys.ACCESS };
String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.ACCESS, ActionKeys.SUBSCRIBE, ActionKeys.ADD_DOCUMENT, ActionKeys.UPDATE, ActionKeys.ADD_SHORTCUT, ActionKeys.ADD_SUBFOLDER, ActionKeys.PERMISSIONS, ActionKeys.DELETE };
try{
ResourcePermissionLocalServiceUtil.setResourcePermissions(folder.getCompanyId(),
DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(folder.getPrimaryKey()), guestMemberRole.getRoleId(), actionIdsGuest);
ResourcePermissionLocalServiceUtil.setResourcePermissions(folder.getCompanyId(),
DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(folder.getPrimaryKey()), siteMemberRole.getRoleId(), actionIds);
} catch (NoSuchResourcePermissionException e){
resourcePermission = ResourcePermissionLocalServiceUtil
.createResourcePermission(CounterLocalServiceUtil.increment());
resourcePermission.setCompanyId(folder.getCompanyId());
resourcePermission.setName(DLFolder.class.getName());
resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
resourcePermission.setPrimKey(String.valueOf(folder.getPrimaryKey()));
resourcePermission.setRoleId(guestMemberRole.getRoleId());
resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
ResourcePermissionLocalServiceUtil.addResourcePermission(resourcePermission);
}
}
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:DocumentUtils.java
示例2: getRowCheckBox
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {
long entryId = GetterUtil.getLong(primaryKey);
TaskRecord entry = TaskRecordLocalServiceUtil.fetchTaskRecord(entryId);
boolean showInput = false;
String name = null;
if (entry != null) {
name = TaskRecord.class.getSimpleName();
try {
if (TaskRecordPermission.contains(_permissionChecker, entry, ActionKeys.DELETE)) {
showInput = true;
}
} catch (Exception e) {
}
}
if (!showInput) {
return StringPool.BLANK;
}
String checkBoxRowIds = getEntryRowIds();
String checkBoxAllRowIds = "'#" + getAllRowIds() + "'";
return getRowCheckBox(request, checked, disabled,
_liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds,
checkBoxAllRowIds, StringPool.BLANK);
}
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:35,代码来源:EntriesChecker.java
示例3: getApplicationDisplayTemplates
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
/**
* Returns the DL File Entry types templates
*
* @param permissionChecker The current context's permission checker
* @param groupId The current site ID
* @param classNameId The template's classNameId
* @return A list of templates indexed by file entry types
*
* @throws PortalException If an error occurs while searching templates
*/
private Map<Group, List<DDMTemplate>> getApplicationDisplayTemplates(PermissionChecker permissionChecker, long groupId, long classNameId) throws PortalException {
HashMap<Group, List<DDMTemplate>> adts = new HashMap<>();
long[] currentGroupIds = this.portal.getCurrentAndAncestorSiteGroupIds(groupId);
long userId = permissionChecker.getUserId();
for(long currentGroupId : currentGroupIds) {
List<DDMTemplate> groupTemplates = this.ddmTemplateService.getTemplates(currentGroupId, classNameId)
.stream()
.filter(template -> {
// See DDMTemplatePermission.java in Liferay's source code for the inspirational stuff
String modelResourceName = DDMTemplate.class.getName();
long companyId = template.getCompanyId();
long templateId = template.getTemplateId();
String actionKey = ActionKeys.VIEW;
return (
permissionChecker.hasOwnerPermission(companyId, modelResourceName, templateId, userId, actionKey) ||
permissionChecker.hasPermission(companyId, modelResourceName, templateId, actionKey)
);
})
.collect(Collectors.toList());
// If we have templates to show, put it in the map
if(!groupTemplates.isEmpty()) {
Group group = this.groupService.getGroup(currentGroupId);
adts.put(group, groupTemplates);
}
}
return adts;
}
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:42,代码来源:FlashlightSearchServiceImpl.java
示例4: getRowCheckBox
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {
long entryId = GetterUtil.getLong(primaryKey);
Contact entry = ContactLocalServiceUtil.fetchContact(entryId);
boolean showInput = false;
String name = null;
if (entry != null) {
name = Contact.class.getSimpleName();
try {
if (ContactPermission.contains(_permissionChecker, entry, ActionKeys.DELETE)) {
showInput = true;
}
} catch (Exception e) {
}
}
if (!showInput) {
return StringPool.BLANK;
}
String checkBoxRowIds = getEntryRowIds();
String checkBoxAllRowIds = "'#" + getAllRowIds() + "'";
return getRowCheckBox(request, checked, disabled,
_liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds,
checkBoxAllRowIds, StringPool.BLANK);
}
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:35,代码来源:EntriesChecker.java
示例5: setFilePermissions
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFilePermissions(FileEntry fileEntry) throws Exception{
ResourcePermission resourcePermission = null;
final Role guestMemberRole = RoleLocalServiceUtil.getRole(fileEntry.getCompanyId(), RoleConstants.GUEST);
ResourceAction resourceAction = ResourceActionLocalServiceUtil.getResourceAction(DLFileEntry.class.getName(), ActionKeys.VIEW);
String[] actionIdsGuest = new String[] { ActionKeys.VIEW, ActionKeys.ACCESS };
try{
resourcePermission = ResourcePermissionLocalServiceUtil.getResourcePermission(fileEntry.getCompanyId(),
DLFileEntry.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(fileEntry
.getPrimaryKey()), guestMemberRole.getRoleId());
ResourcePermissionLocalServiceUtil.setResourcePermissions(fileEntry.getCompanyId(),
DLFileEntry.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(fileEntry.getPrimaryKey()), guestMemberRole.getRoleId(), actionIdsGuest);
// if (Validator.isNotNull(resourcePermission)){
// resourcePermission.setActionIds(resourceAction.getBitwiseValue());
// ResourcePermissionLocalServiceUtil.updateResourcePermission(resourcePermission);
// }
} catch (NoSuchResourcePermissionException e){
resourcePermission = ResourcePermissionLocalServiceUtil
.createResourcePermission(CounterLocalServiceUtil.increment());
resourcePermission.setCompanyId(fileEntry.getCompanyId());
resourcePermission.setName(DLFileEntry.class.getName());
resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
resourcePermission.setPrimKey(String.valueOf(fileEntry.getPrimaryKey()));
resourcePermission.setRoleId(guestMemberRole.getRoleId());
resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
ResourcePermissionLocalServiceUtil.addResourcePermission(resourcePermission);
}
}
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:31,代码来源:DocumentUtils.java
示例6: getRowCheckBox
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {
long entryId = GetterUtil.getLong(primaryKey);
Measurement entry = MeasurementLocalServiceUtil.fetchMeasurement(entryId);
boolean showInput = false;
String name = null;
if (entry != null) {
name = Measurement.class.getSimpleName();
try {
if (MeasurementPermission.contains(_permissionChecker, entry, ActionKeys.DELETE)) {
showInput = true;
}
} catch (Exception e) {
}
}
if (!showInput) {
return StringPool.BLANK;
}
String checkBoxRowIds = getEntryRowIds();
String checkBoxAllRowIds = "'#" + getAllRowIds() + "'";
return getRowCheckBox(request, checked, disabled,
_liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds,
checkBoxAllRowIds, StringPool.BLANK);
}
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:35,代码来源:EntriesChecker.java
示例7: hasViewPermission
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {
return TaskRecordPermission.contains(permissionChecker, _taskRecord, ActionKeys.VIEW);
}
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:6,代码来源:TaskRecordAssetRenderer.java
示例8: hasPermission
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasPermission(PermissionChecker permissionChecker, String entryClassName, long entryClassPK,
String actionId) throws Exception {
return TaskRecordPermission.contains(permissionChecker, entryClassPK, ActionKeys.VIEW);
}
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:6,代码来源:TaskRecordIndexer.java
示例9: hasViewPermission
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {
return ContactPermission.contains(permissionChecker, _contact, ActionKeys.VIEW);
}
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:6,代码来源:ContactAssetRenderer.java
示例10: hasPermission
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasPermission(PermissionChecker permissionChecker, String entryClassName, long entryClassPK,
String actionId) throws Exception {
return ContactPermission.contains(permissionChecker, entryClassPK, ActionKeys.VIEW);
}
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:7,代码来源:ContactIndexer.java
示例11: setFilePermissions
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFilePermissions(FileEntry fileEntry)
throws Exception {
ResourcePermission resourcePermission = null;
final Role guestMemberRole = RoleLocalServiceUtil.getRole(
fileEntry.getCompanyId(), RoleConstants.GUEST);
ResourceAction resourceAction =
ResourceActionLocalServiceUtil.getResourceAction(
DLFileEntry.class.getName(), ActionKeys.VIEW);
String[] actionIdsGuest = new String[] {
ActionKeys.VIEW, ActionKeys.ACCESS
};
try {
resourcePermission =
ResourcePermissionLocalServiceUtil.getResourcePermission(
fileEntry.getCompanyId(), DLFileEntry.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(fileEntry.getPrimaryKey()),
guestMemberRole.getRoleId());
ResourcePermissionLocalServiceUtil.setResourcePermissions(
fileEntry.getCompanyId(), DLFileEntry.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(fileEntry.getPrimaryKey()),
guestMemberRole.getRoleId(), actionIdsGuest);
// if (Validator.isNotNull(resourcePermission)){
// resourcePermission.setActionIds(resourceAction.getBitwiseValue());
// ResourcePermissionLocalServiceUtil.updateResourcePermission(resourcePermission);
// }
}
catch (NoSuchResourcePermissionException e) {
resourcePermission =
ResourcePermissionLocalServiceUtil.createResourcePermission(
CounterLocalServiceUtil.increment());
resourcePermission.setCompanyId(fileEntry.getCompanyId());
resourcePermission.setName(DLFileEntry.class.getName());
resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
resourcePermission.setPrimKey(
String.valueOf(fileEntry.getPrimaryKey()));
resourcePermission.setRoleId(guestMemberRole.getRoleId());
resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
ResourcePermissionLocalServiceUtil.addResourcePermission(
resourcePermission);
}
}
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:47,代码来源:DLFolderUtil.java
示例12: setFolderPermissions
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
public static void setFolderPermissions(Folder folder)
throws Exception {
ResourcePermission resourcePermission = null;
final Role guestMemberRole = RoleLocalServiceUtil.getRole(
folder.getCompanyId(), RoleConstants.GUEST);
final Role siteMemberRole = RoleLocalServiceUtil.getRole(
folder.getCompanyId(), RoleConstants.SITE_MEMBER);
ResourceAction resourceAction =
ResourceActionLocalServiceUtil.getResourceAction(
DLFolder.class.getName(), ActionKeys.VIEW);
String[] actionIdsGuest = new String[] {
ActionKeys.VIEW, ActionKeys.ACCESS
};
String[] actionIds = new String[] {
ActionKeys.VIEW, ActionKeys.ACCESS, ActionKeys.SUBSCRIBE,
ActionKeys.ADD_DOCUMENT, ActionKeys.UPDATE, ActionKeys.ADD_SHORTCUT,
ActionKeys.ADD_SUBFOLDER, ActionKeys.PERMISSIONS, ActionKeys.DELETE
};
try {
ResourcePermissionLocalServiceUtil.setResourcePermissions(
folder.getCompanyId(), DLFolder.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(folder.getPrimaryKey()),
guestMemberRole.getRoleId(), actionIdsGuest);
ResourcePermissionLocalServiceUtil.setResourcePermissions(
folder.getCompanyId(), DLFolder.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(folder.getPrimaryKey()),
siteMemberRole.getRoleId(), actionIds);
}
catch (NoSuchResourcePermissionException e) {
resourcePermission =
ResourcePermissionLocalServiceUtil.createResourcePermission(
CounterLocalServiceUtil.increment());
resourcePermission.setCompanyId(folder.getCompanyId());
resourcePermission.setName(DLFolder.class.getName());
resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL);
resourcePermission.setPrimKey(
String.valueOf(folder.getPrimaryKey()));
resourcePermission.setRoleId(guestMemberRole.getRoleId());
resourcePermission.setActionIds(resourceAction.getBitwiseValue());// (ActionKeys.VIEW);
ResourcePermissionLocalServiceUtil.addResourcePermission(
resourcePermission);
}
}
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:47,代码来源:DLFolderUtil.java
示例13: hasViewPermission
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
@Override
public boolean hasViewPermission(PermissionChecker permissionChecker) {
return MeasurementPermission.contains(permissionChecker, _measurement, ActionKeys.VIEW);
}
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:6,代码来源:MeasurementAssetRenderer.java
示例14: getPermissionsActionId
import com.liferay.portal.kernel.security.permission.ActionKeys; //导入依赖的package包/类
protected String getPermissionsActionId(Data data) {
return ActionKeys.VIEW;
}
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:4,代码来源:IndexCheckerPermissionsHelper.java
注:本文中的com.liferay.portal.kernel.security.permission.ActionKeys类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论