Skip to content

Commit 5d4c832

Browse files
committed
"Add content_type: PloneUser"
1 parent abc43d7 commit 5d4c832

40 files changed

+391
-3
lines changed

pyvenv.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
home = /usr/bin
2+
include-system-site-packages = false
3+
version = 3.8.10
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/zopyx/usersascontent/content/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# -*- coding: utf-8 -*-
2+
# from plone.app.textfield import RichText
3+
# from plone.autoform import directives
4+
from plone.dexterity.content import Container
5+
# from plone.namedfile import field as namedfile
6+
from plone.supermodel import model
7+
# from plone.supermodel.directives import fieldset
8+
# from z3c.form.browser.radio import RadioFieldWidget
9+
# from zope import schema
10+
from zope.interface import implementer
11+
12+
13+
# from zopyx.usersascontent import _
14+
15+
16+
class IPloneUser(model.Schema):
17+
""" Marker interface and Dexterity Python Schema for PloneUser
18+
"""
19+
# If you want, you can load a xml model created TTW here
20+
# and customize it in Python:
21+
22+
# model.load('plone_user.xml')
23+
24+
# directives.widget(level=RadioFieldWidget)
25+
# level = schema.Choice(
26+
# title=_(u'Sponsoring Level'),
27+
# vocabulary=LevelVocabulary,
28+
# required=True
29+
# )
30+
31+
# text = RichText(
32+
# title=_(u'Text'),
33+
# required=False
34+
# )
35+
36+
# url = schema.URI(
37+
# title=_(u'Link'),
38+
# required=False
39+
# )
40+
41+
# fieldset('Images', fields=['logo', 'advertisement'])
42+
# logo = namedfile.NamedBlobImage(
43+
# title=_(u'Logo'),
44+
# required=False,
45+
# )
46+
47+
# advertisement = namedfile.NamedBlobImage(
48+
# title=_(u'Advertisement (Gold-sponsors and above)'),
49+
# required=False,
50+
# )
51+
52+
# directives.read_permission(notes='cmf.ManagePortal')
53+
# directives.write_permission(notes='cmf.ManagePortal')
54+
# notes = RichText(
55+
# title=_(u'Secret Notes (only for site-admins)'),
56+
# required=False
57+
# )
58+
59+
60+
@implementer(IPloneUser)
61+
class PloneUser(Container):
62+
""" Content-type class for IPloneUser
63+
"""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<model
2+
xmlns="http://namespaces.plone.org/supermodel/schema"
3+
xmlns:security="http://namespaces.plone.org/supermodel/security"
4+
xmlns:form="http://namespaces.plone.org/supermodel/form"
5+
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6+
i18n:domain="zopyx.usersascontent">
7+
<schema>
8+
</schema>
9+
</model>

src/zopyx/usersascontent/permissions.zcml

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
<configure zcml:condition="installed AccessControl.security">
77
<!-- -*- extra stuff goes here -*- -->
88

9+
<permission
10+
id="zopyx.usersascontent.AddPloneUser"
11+
title="zopyx.usersascontent: Add PloneUser"
12+
/>
13+
14+
915

1016
</configure>
1117

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version='1.0' encoding='UTF-8'?>
22
<metadata>
33
<version>1000</version>
44
<dependencies>
55
<!--<dependency>profile-plone.app.dexterity:default</dependency>-->
6+
<dependency>profile-plone.app.dexterity:default</dependency>
7+
<dependency>profile-plone.app.relationfield:default</dependency>
68
</dependencies>
79
</metadata>

src/zopyx/usersascontent/profiles/default/rolemap.xml

+8
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
<permissions>
44
<!-- -*- extra stuff goes here -*- -->
55

6+
<permission name="zopyx.usersascontent: Add PloneUser" acquire="True">
7+
<role name="Manager"/>
8+
<role name="Site Administrator"/>
9+
<role name="Owner"/>
10+
<role name="Contributor"/>
11+
</permission>
12+
13+
614
</permissions>
715
</rolemap>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<object name="portal_types" meta_type="Plone Types Tool">
3+
<property name="title">Controls the available contenttypes in your portal</property>
4+
<!--<object name="example_ct" meta_type="Dexterity FTI"/>-->
5+
<object name="PloneUser" meta_type="Dexterity FTI"/>
6+
</object>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?xml version="1.0"?>
2+
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3+
name="PloneUser"
4+
meta_type="Dexterity FTI"
5+
i18n:domain="zopyx.usersascontent">
6+
7+
<!-- Basic properties -->
8+
<property
9+
i18n:translate=""
10+
name="title">PloneUser</property>
11+
<property
12+
i18n:translate=""
13+
name="description">Plone user as content</property>
14+
15+
<property name="allow_discussion">False</property>
16+
<property name="factory">PloneUser</property>
17+
<property name="icon_expr">string:${portal_url}/document_icon.png</property>
18+
<property name="link_target"></property>
19+
20+
<!-- Hierarchy control -->
21+
<property name="global_allow">True</property>
22+
<property name="filter_content_types">True</property>
23+
<property name="allowed_content_types">
24+
<!--
25+
<element value="Document" />
26+
<element value="File" />
27+
-->
28+
</property>
29+
<!-- Schema, class and security -->
30+
<property name="add_permission">zopyx.usersascontent.AddPloneUser</property>
31+
<property name="klass">zopyx.usersascontent.content.plone_user.PloneUser</property>
32+
<property name="model_file"></property>
33+
<property name="model_source"></property>
34+
<property name="schema">zopyx.usersascontent.content.plone_user.IPloneUser</property>
35+
36+
<!-- Enabled behaviors -->
37+
<property name="behaviors" purge="false">
38+
<!-- Details about all standard behaviors following can be read at
39+
https://docs.plone.org/external/plone.app.dexterity/docs/reference/standard-behaviours.html
40+
-->
41+
<element value="plone.namefromtitle"/>
42+
<element value="plone.allowdiscussion"/>
43+
<element value="plone.excludefromnavigation"/>
44+
<element value="plone.shortname"/>
45+
<element value="plone.ownership"/>
46+
<element value="plone.publication"/>
47+
<element value="plone.categorization"/>
48+
<element value="plone.basic"/>
49+
<element value="plone.app.referenceablebehavior.referenceable.IReferenceable" />
50+
<!--<element value="plone.leadimage"/>-->
51+
<!--<element value="plone.relateditems"/>-->
52+
<!--<element value="plone.richtext"/>-->
53+
<!--<element value="plone.tableofcontents"/>-->
54+
<!--<element value="plone.versioning" />-->
55+
<!--<element value="plone.translatable" />-->
56+
<!--<element value="plone.nextprevioustoggle" />-->
57+
<!--<element value="plone.nextpreviousenabled" />-->
58+
<!--<element value="plone.navigationroot" />-->
59+
<!--<element value="plone.selectablecontrainstypes" />-->
60+
</property>
61+
62+
<!-- View information -->
63+
<property name="add_view_expr">string:${folder_url}/++add++PloneUser</property>
64+
<property name="default_view">view</property>
65+
<property name="default_view_fallback">False</property>
66+
<property name="immediate_view">view</property>
67+
<property name="view_methods">
68+
<element value="view"/>
69+
</property>
70+
71+
<!-- Method aliases -->
72+
<alias
73+
from="(Default)"
74+
to="(dynamic view)"
75+
/>
76+
<alias
77+
from="edit"
78+
to="@@edit"
79+
/>
80+
<alias
81+
from="sharing"
82+
to="@@sharing"
83+
/>
84+
<alias
85+
from="view"
86+
to="(selected layout)"
87+
/>
88+
89+
<!-- Actions -->
90+
<action
91+
action_id="view"
92+
category="object"
93+
condition_expr=""
94+
i18n:attributes="title"
95+
i18n:domain="plone"
96+
title="View"
97+
url_expr="string:${object_url}"
98+
visible="True">
99+
<permission value="View"/>
100+
</action>
101+
<action
102+
action_id="edit"
103+
category="object"
104+
condition_expr="not:object/@@plone_lock_info/is_locked_for_current_user|python:True"
105+
i18n:attributes="title"
106+
i18n:domain="plone"
107+
title="Edit"
108+
url_expr="string:${object_url}/edit"
109+
visible="True">
110+
<permission value="Modify portal content"/>
111+
</action>
112+
113+
</object>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# ============================================================================
2+
# DEXTERITY ROBOT TESTS
3+
# ============================================================================
4+
#
5+
# Run this robot test stand-alone:
6+
#
7+
# $ bin/test -s zopyx.usersascontent -t test_plone_user.robot --all
8+
#
9+
# Run this robot test with robot server (which is faster):
10+
#
11+
# 1) Start robot server:
12+
#
13+
# $ bin/robot-server --reload-path src zopyx.usersascontent.testing.ZOPYX_USERSASCONTENT_ACCEPTANCE_TESTING
14+
#
15+
# 2) Run robot tests:
16+
#
17+
# $ bin/robot /src/zopyx/usersascontent/tests/robot/test_plone_user.robot
18+
#
19+
# See the http://docs.plone.org for further details (search for robot
20+
# framework).
21+
#
22+
# ============================================================================
23+
24+
*** Settings *****************************************************************
25+
26+
Resource plone/app/robotframework/selenium.robot
27+
Resource plone/app/robotframework/keywords.robot
28+
29+
Library Remote ${PLONE_URL}/RobotRemote
30+
31+
Test Setup Open test browser
32+
Test Teardown Close all browsers
33+
34+
35+
*** Test Cases ***************************************************************
36+
37+
Scenario: As a site administrator I can add a PloneUser
38+
Given a logged-in site administrator
39+
and an add PloneUser form
40+
When I type 'My PloneUser' into the title field
41+
and I submit the form
42+
Then a PloneUser with the title 'My PloneUser' has been created
43+
44+
Scenario: As a site administrator I can view a PloneUser
45+
Given a logged-in site administrator
46+
and a PloneUser 'My PloneUser'
47+
When I go to the PloneUser view
48+
Then I can see the PloneUser title 'My PloneUser'
49+
50+
51+
*** Keywords *****************************************************************
52+
53+
# --- Given ------------------------------------------------------------------
54+
55+
a logged-in site administrator
56+
Enable autologin as Site Administrator
57+
58+
an add PloneUser form
59+
Go To ${PLONE_URL}/++add++PloneUser
60+
61+
a PloneUser 'My PloneUser'
62+
Create content type=PloneUser id=my-plone_user title=My PloneUser
63+
64+
# --- WHEN -------------------------------------------------------------------
65+
66+
I type '${title}' into the title field
67+
Input Text name=form.widgets.IBasic.title ${title}
68+
69+
I submit the form
70+
Click Button Save
71+
72+
I go to the PloneUser view
73+
Go To ${PLONE_URL}/my-plone_user
74+
Wait until page contains Site Map
75+
76+
77+
# --- THEN -------------------------------------------------------------------
78+
79+
a PloneUser with the title '${title}' has been created
80+
Wait until page contains Site Map
81+
Page should contain ${title}
82+
Page should contain Item created
83+
84+
I can see the PloneUser title '${title}'
85+
Wait until page contains Site Map
86+
Page should contain ${title}

0 commit comments

Comments
 (0)