Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some refactoring to improve tests and allow users to access data #1

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .travis.yml

This file was deleted.

15 changes: 13 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ Changelog
1.0.1 (unreleased)
------------------

- Nothing changed yet.

- Only managers can access deleted feedbacks.
[cekk]
- Allow all authenticated users to access @feedback endpoint.
The endpoint will return only feedbacks on objects that they can edit.
[cekk]
- Improve tests.
[cekk]
- Install souper.plone to have its control-panel in backend.
[cekk]
- Remove unused user action.
[cekk]
- Add `actions` infos in @feedback endpoint, to let the frontend know what the user can do.
[cekk]

1.0.0 (2023-02-16)
------------------
Expand Down
16 changes: 16 additions & 0 deletions base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ parts =
robot
plone-helper-scripts
vscode
zpretty
zpretty-run

develop = .

Expand Down Expand Up @@ -109,6 +111,20 @@ scripts =
zopepy
plone-compile-resources

[zpretty]
recipe = zc.recipe.egg
eggs =
zpretty

[zpretty-run]
recipe = collective.recipe.template
input = inline:
#!/bin/bash
find src -name '*.zcml' | xargs bin/zpretty -i
output = ${buildout:directory}/bin/zpretty-run
mode = 755


[versions]
# Don't use a released version of collective.feedback
collective.feedback =
22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@
python_requires=">=3.7",
install_requires=[
"setuptools",
# -*- Extra requirements: -*-
"z3c.jbot",
"plone.api>=1.8.4",
"plone.app.dexterity",
"souper.plone",
"collective.honeypot>=2.1",
],
extras_require={
"test": [
"gocept.pytestlayer",
"plone.app.testing",
# Plone KGS does not use this version, because it would break
# Remove if your package shall be part of coredev.
# plone_coredev tests as of 2016-04-01.
"plone.testing>=5.0.0",
"plone.app.contenttypes",
"plone.app.robotframework[debug]",
"plone.restapi[test]",
"pytest-cov",
"pytest-plone>=0.2.0",
"pytest-docker",
"pytest-mock",
"pytest",
"zest.releaser[recommended]",
"zestreleaser.towncrier",
"pytest-mock",
"requests-mock",
],
},
entry_points="""
Expand Down
10 changes: 10 additions & 0 deletions src/collective/feedback/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
<i18n:registerTranslations directory="locales" />

<include file="permissions.zcml" />
<include file="upgrades.zcml" />

<include package=".storage" />
<include package=".restapi" />


<genericsetup:registerProfile
name="default"
title="collective.feedback"
Expand All @@ -31,6 +33,14 @@
post_handler=".setuphandlers.uninstall"
/>

<genericsetup:registerProfile
name="to_1100"
title="collective.feedback (to_1100)"
description=""
provides="Products.GenericSetup.interfaces.EXTENSION"
directory="profiles/to_1100"
/>

<utility
factory=".setuphandlers.HiddenProfiles"
name="collective.feedback-hiddenprofiles"
Expand Down
13 changes: 11 additions & 2 deletions src/collective/feedback/permissions.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@

<configure zcml:condition="installed AccessControl.security">
<permission
id="collective.feedback.ManageFeedbacks"
title="collective.feedback: Manage Feedbacks"
id="collective.feedback.DeleteFeedbacks"
title="collective.feedback: Delete Feedbacks"
/>
<permission
id="collective.feedback.AccessFeedbacks"
title="collective.feedback: Access Feedbacks"
/>
<permission
id="collective.feedback.FeedbacksOverview"
title="collective.feedback: Feedbacks Overview"
/>
<permission
id="collective.feedback.ShowDeletedFeedbacks"
title="collective.feedback: Show Deleted Feedbacks"
/>

</configure>

</configure>
27 changes: 0 additions & 27 deletions src/collective/feedback/profiles/default/actions.xml

This file was deleted.

5 changes: 3 additions & 2 deletions src/collective/feedback/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<version>1000</version>
<version>1100</version>
<dependencies>
<!--<dependency>profile-plone.app.dexterity:default</dependency>-->
<dependency>profile-plone.restapi:default</dependency>
<dependency>profile-souper.plone:default</dependency>
</dependencies>
</metadata>
12 changes: 11 additions & 1 deletion src/collective/feedback/profiles/default/rolemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<permissions>

<permission acquire="True"
name="collective.feedback: Manage Feedbacks"
name="collective.feedback: Delete Feedbacks"
>
<role name="Manager" />
<role name="Site Administrator" />
Expand All @@ -12,9 +12,19 @@
<permission acquire="True"
name="collective.feedback: Access Feedbacks"
>
<role name="Editor" />
<role name="Manager" />
<role name="Site Administrator" />
</permission>

<permission acquire="True" name="collective.feedback: Feedbacks Overview">
<role name="Authenticated" />
</permission>

<permission acquire="True" name="collective.feedback: Show Deleted Feedbacks">
<role name="Manager" />
<role name="Site Administrator" />
</permission>

</permissions>
</rolemap>
6 changes: 6 additions & 0 deletions src/collective/feedback/profiles/default/to_1100/rolemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<rolemap>
<permissions>
<permission remove="True" name="collective.feedback: Manage Feedbacks" />
</permissions>
</rolemap>
6 changes: 3 additions & 3 deletions src/collective/feedback/restapi/services/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@
method="GET"
factory=".get.FeedbackGet"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
permission="collective.feedback.AccessFeedbacks"
permission="collective.feedback.FeedbacksOverview"
layer="collective.feedback.interfaces.ICollectiveFeedbackLayer"
name="@feedback"
/>
<plone:service
method="GET"
factory=".get.FeedbackGetCSV"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
permission="collective.feedback.AccessFeedbacks"
permission="collective.feedback.FeedbacksOverview"
layer="collective.feedback.interfaces.ICollectiveFeedbackLayer"
name="@feedback-csv"
/>
<plone:service
method="DELETE"
factory=".delete.FeedbackDelete"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
permission="collective.feedback.ManageFeedbacks"
permission="collective.feedback.DeleteFeedbacks"
layer="collective.feedback.interfaces.ICollectiveFeedbackLayer"
name="@feedback-delete"
/>
Expand Down
Loading
Loading