plone / guillotina

Python AsyncIO data API to manage billions of resources
https://guillotina.readthedocs.io/en/latest/
Other
188 stars 51 forks source link

Be able to configure type as not globally addable #800

Closed lferran closed 4 years ago

jordic commented 4 years ago

So sorry, I'm not pretty sure what's on, just discovered the Interface IConstrainTYpes.. perhaps it's as easy of implementing this? There is also the conf setting of 'cobtainer_types'. @vangheem?

lferran commented 4 years ago

@vangheem done the requested changes :+1:

codecov-io commented 4 years ago

Codecov Report

Merging #800 into master will increase coverage by 0.1%. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #800     +/-   ##
========================================
+ Coverage    94.3%   94.3%   +0.1%     
========================================
  Files         309     312      +3     
  Lines       28192   28299    +107     
========================================
+ Hits        26575   26685    +110     
+ Misses       1617    1614      -3
Impacted Files Coverage Δ
guillotina/configure/__init__.py 90.1% <ø> (ø) :arrow_up:
guillotina/contrib/dbusers/content/users.py 96.8% <ø> (ø) :arrow_up:
guillotina/tests/test_transactions.py 100% <ø> (ø) :arrow_up:
guillotina/contrib/dbusers/content/groups.py 86.5% <ø> (ø) :arrow_up:
guillotina/api/content.py 90.9% <100%> (ø) :arrow_up:
guillotina/tests/dbusers/test_manage_groups.py 100% <100%> (ø) :arrow_up:
guillotina/tests/test_content.py 100% <100%> (ø) :arrow_up:
guillotina/tests/dbusers/test_manage_users.py 100% <100%> (ø) :arrow_up:
guillotina/content.py 92.8% <100%> (+0.1%) :arrow_up:
guillotina/tests/dbusers/test_api.py 100% <100%> (ø) :arrow_up:
... and 18 more
jordic commented 4 years ago

Hey, tha't super cool, but it solves the issue https://github.com/plone/guillotina/issues/778 or this https://github.com/plone/guillotina/issues/771.

May I close them?

What should I do to restrict some types to only some folders?

lferran commented 4 years ago

@jordic you have to define that content as @configure.contenttype("MyType", ..., globally_addable=False) but then allow it on those folders @configure.contenttype("MyFolder", ..., allowed_types=["MyType"])

jordic commented 4 years ago

Then we could close both issues :)