本文整理汇总了Java中org.alfresco.service.cmr.invitation.InvitationExceptionForbidden类的典型用法代码示例。如果您正苦于以下问题:Java InvitationExceptionForbidden类的具体用法?Java InvitationExceptionForbidden怎么用?Java InvitationExceptionForbidden使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvitationExceptionForbidden类属于org.alfresco.service.cmr.invitation包,在下文中一共展示了InvitationExceptionForbidden类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cancelInvitation
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden; //导入依赖的package包/类
@Override
public void cancelInvitation(String siteName, String invitee, String inviteId, String currentInviteId)
{
if (!AuthenticationUtil.isRunAsUserTheSystemUser())
{
String currentUserName = authenticationService.getCurrentUserName();
String currentUserSiteRole = siteService.getMembersRole(siteName, currentUserName);
if (SiteModel.SITE_MANAGER.equals(currentUserSiteRole)== false)
{
// The current user is not the site manager
Object[] args = {currentUserName, inviteId, siteName};
throw new InvitationExceptionForbidden(MSG_NOT_SITE_MANAGER, args);
}
}
// Clean up invitee's user account and person node if they are not in use i.e.
// account is still disabled and there are no pending invites outstanding for the
// invitee
deleteAuthenticationIfUnused(invitee, currentInviteId);
}
示例2: checkManagerRole
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden; //导入依赖的package包/类
/**
* Check that the specified user has manager role over the resource.
*
* @param userId user id
* @throws InvitationException
*/
private void checkManagerRole(String userId, Invitation.ResourceType resourceType, String siteShortName)
{
// if inviter is not the site manager then throw web script exception
String inviterRole = this.siteService.getMembersRole(siteShortName, userId);
if ((inviterRole == null) || (inviterRole.equals(SiteModel.SITE_MANAGER) == false))
{
Object objs[] = { userId, siteShortName };
throw new InvitationExceptionForbidden("invitation.invite.not_site_manager", objs);
}
}
示例3: handle
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden; //导入依赖的package包/类
@Override
public boolean handle(Throwable t)
{
if(t instanceof InvitationExceptionForbidden)
{
// Note: security, no message to indicate why
throw new NotFoundException();
}
return super.handle(t);
}
示例4: executeImpl
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> model = new HashMap<String, Object>();
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
final String siteShortName = templateVars.get("shortname");
final String invitationId = templateVars.get("invitationId");
validateParameters(siteShortName, invitationId);
try
{
// MNT-9905 Pending Invites created by one site manager aren't visible to other site managers
String currentUser = AuthenticationUtil.getRunAsUser();
if (siteShortName != null && (SiteModel.SITE_MANAGER).equals(siteService.getMembersRole(siteShortName, currentUser)))
{
RunAsWork<Void> runAsSystem = new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
checkAndCancelTheInvitation(invitationId, siteShortName);
return null;
}
};
AuthenticationUtil.runAs(runAsSystem, AuthenticationUtil.getSystemUserName());
}
else
{
checkAndCancelTheInvitation(invitationId, siteShortName);
}
}
catch (InvitationExceptionForbidden fe)
{
throw new WebScriptException(Status.STATUS_FORBIDDEN, "Unable to cancel workflow", fe);
}
catch (AccessDeniedException ade)
{
throw new WebScriptException(Status.STATUS_FORBIDDEN, "Unable to cancel workflow", ade);
}
return model;
}