}
// after the resource is set up (in the case of non-templates), we can use the checkPermission on it
if (checkPerms && checkPermission(subject, alertDefinition) == false) {
if (alertDefinition.getResourceType() != null) {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to create alert templates for type ["
+ alertDefinition.getResourceType() + "]");
} else if (alertDefinition.getGroup() != null) {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to create alert definitions for group [" + alertDefinition.getGroup()
+ "]");
} else {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to create alert definitions for resource ["
+ alertDefinition.getResource() + "]");
}
}