本文整理汇总了Java中com.liferay.portal.security.auth.PrincipalException类的典型用法代码示例。如果您正苦于以下问题:Java PrincipalException类的具体用法?Java PrincipalException怎么用?Java PrincipalException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrincipalException类属于com.liferay.portal.security.auth包,在下文中一共展示了PrincipalException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllEntities
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getAllEntities() {
try {
PermissionChecker pc = getPermissionChecker();
long userId = pc.getUserId();
_log.debug("userId: " + userId);
_log.debug("pc.isSignedIn(): " + pc.isSignedIn());
_log.debug("getCompanyId: " + pc.getCompanyId());
User _user = userLocalService.fetchUser(userId);
_log.debug("_user.getFullName(): " + _user.getFullName());
_log.debug("_user.isActive(): " + _user.isActive());
_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
_log.debug("_user.isLockout(): " + _user.isLockout());
_log.debug("_user.isNew(): " + _user.isNew());
} catch (PrincipalException pe) {
pe.printStackTrace();
} catch (SystemException se) {
se.printStackTrace();
}
return ogpd_EntityLocalService.getOGPD_Entities();
}
示例2: getRegionEntitiesForWidget
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getRegionEntitiesForWidget(String regionID) {
try {
PermissionChecker pc = getPermissionChecker();
long userId = pc.getUserId();
_log.debug("userId: " + userId);
_log.debug("pc.isSignedIn(): " + pc.isSignedIn());
_log.debug("getCompanyId: " + pc.getCompanyId());
User _user = userLocalService.fetchUser(userId);
_log.debug("_user.getFullName(): " + _user.getFullName());
_log.debug("_user.isActive(): " + _user.isActive());
_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
_log.debug("_user.isLockout(): " + _user.isLockout());
_log.debug("_user.isNew(): " + _user.isNew());
} catch (PrincipalException pe) {
pe.printStackTrace();
} catch (SystemException se) {
se.printStackTrace();
}
return ogpd_EntityLocalService.getRegionEntitiesForWidget(regionID);
}
示例3: getRegionEntitiesForWidgetParamFirst
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getRegionEntitiesForWidgetParamFirst(String regionID, String name) {
try {
PermissionChecker pc = getPermissionChecker();
long userId = pc.getUserId();
_log.debug("userId: " + userId);
_log.debug("pc.isSignedIn(): " + pc.isSignedIn());
_log.debug("getCompanyId: " + pc.getCompanyId());
User _user = userLocalService.fetchUser(userId);
_log.debug("_user.getFullName(): " + _user.getFullName());
_log.debug("_user.isActive(): " + _user.isActive());
_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
_log.debug("_user.isLockout(): " + _user.isLockout());
_log.debug("_user.isNew(): " + _user.isNew());
} catch (PrincipalException pe) {
pe.printStackTrace();
} catch (SystemException se) {
se.printStackTrace();
}
return ogpd_EntityLocalService.getRegionEntitiesForWidgetParamFirst(regionID, name);
}
示例4: getOpenDataEntitiesForWidget
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public JSONArray getOpenDataEntitiesForWidget() {
try {
PermissionChecker pc = getPermissionChecker();
long userId = pc.getUserId();
_log.debug("userId: " + userId);
_log.debug("pc.isSignedIn(): " + pc.isSignedIn());
_log.debug("getCompanyId: " + pc.getCompanyId());
User _user = userLocalService.fetchUser(userId);
_log.debug("_user.getFullName(): " + _user.getFullName());
_log.debug("_user.isActive(): " + _user.isActive());
_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
_log.debug("_user.isLockout(): " + _user.isLockout());
_log.debug("_user.isNew(): " + _user.isNew());
} catch (PrincipalException pe) {
pe.printStackTrace();
} catch (SystemException se) {
se.printStackTrace();
}
return ogpd_EntityLocalService.getOpenDataEntitiesForWidget();
}
示例5: removeStudentFromCourse
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
@JSONWebService
public void removeStudentFromCourse(long courseId,String login) throws PrincipalException, PortalException, SystemException
{
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
Course course=courseLocalService.getCourse(courseId);
if(getPermissionChecker().hasPermission(course.getGroupId(), Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
{
User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
GroupLocalServiceUtil.unsetUserGroups(user.getUserId(),new long[] { course.getGroupCreatedId() });
//auditing
AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UNREGISTER, null);
}
}
示例6: findExportedRoomsInCompany
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/**
* Retorna todas as salas que tiveram seu histórico definido em uma
* instancia do portal
*
* @param companyId
* @return
* @throws SystemException
*/
public final ChatRoomBean[] findExportedRoomsInCompany(long companyId) throws SystemException {
List<ChatRoom> rs = ChatRoomFinderUtil.findExportedRoomsInCompany(companyId);
List<ChatRoomBean> retorno = new ArrayList<ChatRoomBean>();
for (ChatRoom chatRoom : rs) {
try {
if (canView(chatRoom)) {
retorno.add(convertToChatRoomBean(chatRoom, false, false, false));
}
} catch (PrincipalException e) {
throw new SystemException("Erro ao checar permissão de visualizar.", e);
}
}
ChatRoomBean[] result = new ChatRoomBean[(retorno.size())];
return retorno.toArray(result);
}
示例7: addVoto
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/**
* Adiciona um voto na proposta especificada
*
* @param propostaId
* @throws PortalException
* @throws SystemException
*/
@Override
public void addVoto(long propostaId) throws PortalException, SystemException {
Proposta proposta = PropostaLocalServiceUtil.getProposta(propostaId);
long groupId = proposta.getGroupId();
User user = getGuestOrUser();
if (user.isDefaultUser())
return;
PermissionChecker checker = getPermissionChecker();
if (!PriorizacaoPermissionsUtil.hasPermission(checker, groupId, "VOTE"))
throw new PrincipalException("Sem permissão para votar");
VotoLocalServiceUtil.addVoto(propostaId, user.getUserId());
}
示例8: hasJournalFolderPermission
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/***
* This was taken from JournalFolderPermission which is located in
* portal-impl. The code was shortened because we are expecting to evaluate
* just Delete and Update actions for now.
*
* @param folder
* @return true if it has permission the given action
*/
private boolean hasJournalFolderPermission(final JournalFolder folder, final String actionId) {
PermissionChecker permissionChecker;
try {
permissionChecker = getPermissionChecker();
} catch (PrincipalException e) {
log.error(e);
return false;
}
Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, folder.getGroupId(),
JournalFolder.class.getName(), folder.getFolderId(), PortletKeys.JOURNAL, actionId);
if (hasPermission != null) {
return hasPermission.booleanValue();
}
return _hasPermission(permissionChecker, folder, actionId);
}
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:27,代码来源:EnhancedJournalAppServiceImpl.java
示例9: check
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(PermissionChecker permissionChecker, long groupId,
String actionId) throws PortalException {
if (!contains(permissionChecker, groupId, actionId)) {
throw new PrincipalException();
}
}
示例10: check
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
PermissionChecker permissionChecker, DossierProc proc,
String actionId)
throws PortalException {
if (!contains(permissionChecker, proc, actionId)) {
throw new PrincipalException();
}
}
示例11: getApplicationsCount
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public int getApplicationsCount() throws SystemException, PrincipalException {
_log.debug("getApplicationsCount: ");
// PermissionChecker pc = getPermissionChecker();
// _log.debug("userId: " + pc.getUserId());
// _log.debug("getCompanyId: " + pc.getCompanyId());
return applicationLocalService.getApplicationsCount(10154);
}
示例12: deleteVoto
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
/**
* Remove um voto na proposta especificada
*
* @param propostaId
* @throws PortalException
* @throws SystemException
*/
public void deleteVoto(long propostaId) throws PortalException, SystemException {
Proposta proposta = PropostaLocalServiceUtil.getProposta(propostaId);
long groupId = proposta.getGroupId();
User user = getGuestOrUser();
if (user.isDefaultUser())
return;
PermissionChecker checker = getPermissionChecker();
if (!PriorizacaoPermissionsUtil.hasPermission(checker, groupId, "VOTE"))
throw new PrincipalException("Sem permissão para votar");
VotoLocalServiceUtil.deleteVoto(propostaId, user.getUserId());
}
示例13: _getPermissionChecker
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
private static PermissionChecker _getPermissionChecker() throws PrincipalException {
PermissionChecker permissionChecker =
PermissionThreadLocal.getPermissionChecker();
if (permissionChecker == null) {
throw new PrincipalException("PermissionChecker not initialized");
}
return permissionChecker;
}
示例14: check
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
PermissionChecker permissionChecker, long artistId, String actionId)
throws PortalException {
if (!contains(permissionChecker, artistId, actionId)) {
throw new PrincipalException();
}
}
示例15: check
import com.liferay.portal.security.auth.PrincipalException; //导入依赖的package包/类
public static void check(
PermissionChecker permissionChecker, long groupId, String actionId)
throws PortalException {
if (!contains(permissionChecker, groupId, actionId)) {
throw new PrincipalException();
}
}