Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Mailman Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
304
Issues
304
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
43
Merge Requests
43
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNU Mailman
Mailman Core
Commits
61877ba9
Commit
61877ba9
authored
Sep 13, 2015
by
Barry Warsaw
Committed by
GitLab
Sep 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document an attribute.
Add a doctest for the `owners` top-level resource.
parent
4e92face
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
+64
-0
src/mailman/interfaces/user.py
src/mailman/interfaces/user.py
+3
-0
src/mailman/rest/docs/owners.rst
src/mailman/rest/docs/owners.rst
+61
-0
No files found.
src/mailman/interfaces/user.py
View file @
61877ba9
...
...
@@ -70,6 +70,9 @@ class IUser(Interface):
memberships
=
Attribute
(
"""A roster of this user's memberships."""
)
is_server_owner
=
Attribute
(
"""Boolean flag indicating whether the user is a server owner."""
)
def
register
(
email
,
display_name
=
None
):
"""Register the given email address and link it to this user.
...
...
src/mailman/rest/docs/owners.rst
0 → 100644
View file @
61877ba9
===============
Server owners
===============
Certain users can be designated as *server owners*. This role has no direct
function in the core, but it can be used by clients of the REST API to
determine additional permissions. For example, Postorius might allow server
owners to create new domains.
Initially, there are no server owners.
>>> dump_json('http://localhost:9001/3.0/owners')
http_etag: "..."
start: 0
total_size: 0
When new users are created in the core, they do not become server owners by
default.
>>> from zope.component import getUtility
>>> from mailman.interfaces.usermanager import IUserManager
>>> user_manager = getUtility(IUserManager)
>>> anne = user_manager.create_user('anne@example.com', 'Anne Person')
>>> transaction.commit()
>>> dump_json('http://localhost:9001/3.0/owners')
http_etag: "..."
start: 0
total_size: 0
Anne's server owner flag is set.
>>> anne.is_server_owner = True
>>> transaction.commit()
And now we can find her user record.
>>> dump_json('http://localhost:9001/3.0/owners')
http_etag: "..."
start: 0
total_size: 1
Bart and Cate are also users, but not server owners.
>>> bart = user_manager.create_user('bart@example.com', 'Bart Person')
>>> cate = user_manager.create_user('cate@example.com', 'Cate Person')
>>> transaction.commit()
>>> dump_json('http://localhost:9001/3.0/owners')
http_etag: "..."
start: 0
total_size: 1
Anne retires as a server owner, with Bart and Cate taking over.
>>> anne.is_server_owner = False
>>> bart.is_server_owner = True
>>> cate.is_server_owner = True
>>> transaction.commit()
>>> dump_json('http://localhost:9001/3.0/owners')
http_etag: "..."
start: 0
total_size: 2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment