Function
isPublicProjectFilterAllowed
(project, chart, passwordInput)
Source from the content-addressed store, hash-verified
| 250 | }; |
| 251 | |
| 252 | const isPublicProjectFilterAllowed = async (project, chart, passwordInput) => { |
| 253 | if (!project?.public) { |
| 254 | return false; |
| 255 | } |
| 256 | |
| 257 | if (project?.passwordProtected && passwordInput !== project.password) { |
| 258 | return false; |
| 259 | } |
| 260 | |
| 261 | if (!chart?.onReport) { |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | const sharePolicy = await db.SharePolicy.findOne({ |
| 266 | where: { |
| 267 | entity_type: "Project", |
| 268 | entity_id: project.id, |
| 269 | }, |
| 270 | }); |
| 271 | |
| 272 | if (!sharePolicy) { |
| 273 | return true; |
| 274 | } |
| 275 | |
| 276 | if (sharePolicy.visibility === "disabled") { |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | return sharePolicy.visibility === "public"; |
| 281 | }; |
| 282 | |
| 283 | const checkFilterAccess = async (req, res, next) => { |
| 284 | try { |
Tested by
no test coverage detected