|
41 | 41 | import org.labkey.api.action.ReturnUrlForm; |
42 | 42 | import org.labkey.api.action.SimpleViewAction; |
43 | 43 | import org.labkey.api.action.SpringActionController; |
44 | | -import org.labkey.api.admin.notification.NotificationService; |
45 | 44 | import org.labkey.api.attachments.Attachment; |
46 | 45 | import org.labkey.api.attachments.AttachmentFile; |
47 | 46 | import org.labkey.api.attachments.AttachmentForm; |
|
81 | 80 | import org.labkey.api.reports.model.ViewCategory; |
82 | 81 | import org.labkey.api.reports.model.ViewCategoryManager; |
83 | 82 | import org.labkey.api.reports.model.ViewInfo; |
84 | | -import org.labkey.api.reports.permissions.ShareReportPermission; |
85 | 83 | import org.labkey.api.reports.report.AbstractReport; |
86 | 84 | import org.labkey.api.reports.report.AbstractReportIdentifier; |
87 | 85 | import org.labkey.api.reports.report.ModuleReportIdentifier; |
|
112 | 110 | import org.labkey.api.security.RequiresNoPermission; |
113 | 111 | import org.labkey.api.security.RequiresPermission; |
114 | 112 | import org.labkey.api.security.RequiresSiteAdmin; |
115 | | -import org.labkey.api.security.SecurityManager; |
116 | 113 | import org.labkey.api.security.User; |
117 | 114 | import org.labkey.api.security.UserManager; |
118 | 115 | import org.labkey.api.security.permissions.AdminOperationsPermission; |
|
123 | 120 | import org.labkey.api.study.Dataset; |
124 | 121 | import org.labkey.api.study.Study; |
125 | 122 | import org.labkey.api.study.StudyService; |
126 | | -import org.labkey.api.study.StudyUrls; |
127 | 123 | import org.labkey.api.study.reports.CrosstabReport; |
128 | 124 | import org.labkey.api.thumbnail.BaseThumbnailAction; |
129 | 125 | import org.labkey.api.thumbnail.ThumbnailProvider; |
@@ -281,16 +277,6 @@ public ActionURL urlExportCrosstab(Container c) |
281 | 277 | return new ActionURL(CrosstabExportAction.class, c); |
282 | 278 | } |
283 | 279 |
|
284 | | - @Override |
285 | | - public ActionURL urlShareReport(Container c, Report r) |
286 | | - { |
287 | | - if (r.getDescriptor().getReportId() == null) |
288 | | - return null; |
289 | | - ActionURL url = new ActionURL(ShareReportAction.class, c); |
290 | | - url.addParameter("reportId", r.getDescriptor().getReportId().toString()); |
291 | | - return url; |
292 | | - } |
293 | | - |
294 | 280 | @Override |
295 | 281 | public ActionURL urlImage(Container c, Report r, ImageType type, @Nullable Integer revision) |
296 | 282 | { |
@@ -1036,115 +1022,6 @@ public void addNavTrail(NavTree root) |
1036 | 1022 | } |
1037 | 1023 | } |
1038 | 1024 |
|
1039 | | - @RequiresPermission(ShareReportPermission.class) |
1040 | | - public static class ShareReportAction extends FormViewAction<ShareReportForm> |
1041 | | - { |
1042 | | - Report _report = null; |
1043 | | - List<User> _validRecipients = new ArrayList<>(); |
1044 | | - |
1045 | | - @Override |
1046 | | - public ModelAndView getView(ShareReportForm form, boolean reshow, BindException errors) |
1047 | | - { |
1048 | | - return new JspView<>("/org/labkey/query/reports/view/shareReport.jsp", form, errors); |
1049 | | - } |
1050 | | - |
1051 | | - @Override |
1052 | | - public void validateCommand(ShareReportForm form, Errors errors) |
1053 | | - { |
1054 | | - _validRecipients = SecurityManager.parseRecipientListForContainer(getContainer(), form.getRecipientList(), errors); |
1055 | | - } |
1056 | | - |
1057 | | - @Override |
1058 | | - public boolean handlePost(ShareReportForm form, BindException errors) throws Exception |
1059 | | - { |
1060 | | - if (null != form.getReportId()) |
1061 | | - _report = form.getReportId().getReport(getViewContext()); |
1062 | | - |
1063 | | - if (!errors.hasErrors() && !_validRecipients.isEmpty() && _report != null) |
1064 | | - { |
1065 | | - for (User recipient : _validRecipients) |
1066 | | - { |
1067 | | - NotificationService.get().sendMessageForRecipient( |
1068 | | - getContainer(), getUser(), recipient, |
1069 | | - form.getMessageSubject(), form.getMessageBody(), _report.getRunReportURL(getViewContext()), |
1070 | | - form.getReportId().toString(), Report.SHARE_REPORT_TYPE |
1071 | | - ); |
1072 | | - |
1073 | | - // if the report is already public, send the notification but don't update the policy |
1074 | | - if (!ReportDescriptor.REPORT_ACCESS_PUBLIC.equals(_report.getDescriptor().getAccess())) |
1075 | | - ReportUtil.updateReportSecurityPolicy(getViewContext(), _report, recipient.getUserId(), true); |
1076 | | - |
1077 | | - String auditMsg = "The following report was shared: recipient: " + recipient.getName() + " (" + recipient.getUserId() + ")" |
1078 | | - + ", reportId: " + _report.getDescriptor().getReportId() |
1079 | | - + ", name: " + _report.getDescriptor().getReportName(); |
1080 | | - StudyService.get().addStudyAuditEvent(getContainer(), getUser(), auditMsg); |
1081 | | - } |
1082 | | - } |
1083 | | - |
1084 | | - return !errors.hasErrors(); |
1085 | | - } |
1086 | | - |
1087 | | - @Override |
1088 | | - public URLHelper getSuccessURL(ShareReportForm form) |
1089 | | - { |
1090 | | - if (_report != null && getContainer().hasPermission(getUser(), AdminPermission.class)) |
1091 | | - { |
1092 | | - return urlProvider(StudyUrls.class).getManageReportPermissions(getContainer()). |
1093 | | - addParameter(ReportDescriptor.Prop.reportId, _report.getDescriptor().getReportId().toString()); |
1094 | | - } |
1095 | | - |
1096 | | - return form.getReturnActionURL(form.getDefaultUrl(getContainer())); |
1097 | | - } |
1098 | | - |
1099 | | - @Override |
1100 | | - public void addNavTrail(NavTree root) |
1101 | | - { |
1102 | | - root.addChild("Share Report"); |
1103 | | - } |
1104 | | - } |
1105 | | - |
1106 | | - public static class ShareReportForm extends ReportDesignBean<Report> |
1107 | | - { |
1108 | | - private String _recipientList; |
1109 | | - private String _messageSubject; |
1110 | | - private String _messageBody; |
1111 | | - |
1112 | | - public String getRecipientList() |
1113 | | - { |
1114 | | - return _recipientList; |
1115 | | - } |
1116 | | - |
1117 | | - public void setRecipientList(String recipientList) |
1118 | | - { |
1119 | | - _recipientList = recipientList; |
1120 | | - } |
1121 | | - |
1122 | | - public String getMessageSubject() |
1123 | | - { |
1124 | | - return _messageSubject; |
1125 | | - } |
1126 | | - |
1127 | | - public void setMessageSubject(String messageSubject) |
1128 | | - { |
1129 | | - _messageSubject = messageSubject; |
1130 | | - } |
1131 | | - |
1132 | | - public String getMessageBody() |
1133 | | - { |
1134 | | - return _messageBody; |
1135 | | - } |
1136 | | - |
1137 | | - public void setMessageBody(String messageBody) |
1138 | | - { |
1139 | | - _messageBody = messageBody; |
1140 | | - } |
1141 | | - |
1142 | | - public ActionURL getDefaultUrl(Container container) |
1143 | | - { |
1144 | | - return new ActionURL(ManageViewsAction.class, container); |
1145 | | - } |
1146 | | - } |
1147 | | - |
1148 | 1025 | @RequiresPermission(ReadPermission.class) |
1149 | 1026 | public class DetailsAction extends SimpleViewAction<ReportDesignBean<?>> |
1150 | 1027 | { |
|
0 commit comments