You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/02/21 18:56:12 UTC
[1/2] git commit: [#7173] expose many model docs
Repository: incubator-allura
Updated Branches:
refs/heads/master 8a6bf21e6 -> 2a44a8ef8
[#7173] expose many model docs
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2a44a8ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2a44a8ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2a44a8ef
Branch: refs/heads/master
Commit: 2a44a8ef88103bd362671895911333b5707167d3
Parents: 3b88949
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Feb 13 14:23:55 2014 -0500
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Feb 21 17:55:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/monq_model.py | 4 +--
Allura/allura/model/notification.py | 2 ++
Allura/allura/model/project.py | 9 ++++--
Allura/allura/model/timeline.py | 10 +++++--
Allura/allura/model/types.py | 12 +++++++-
Allura/docs/api/lib/security.rst | 2 --
Allura/docs/api/model.rst | 39 +++-----------------------
Allura/docs/api/model/artifact.rst | 43 +++++++++++++++++++++++++++++
Allura/docs/api/model/auth.rst | 30 ++++++++++++++++++++
Allura/docs/api/model/monq_model.rst | 22 +++++++++++++++
Allura/docs/api/model/neighborhood.rst | 22 +++++++++++++++
Allura/docs/api/model/notification.rst | 22 +++++++++++++++
Allura/docs/api/model/project.rst | 22 +++++++++++++++
Allura/docs/api/model/session.rst | 22 +++++++++++++++
Allura/docs/api/model/timeline.rst | 22 +++++++++++++++
Allura/docs/api/model/types.rst | 22 +++++++++++++++
16 files changed, 260 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index d4359f5..a04bc38 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -55,8 +55,8 @@ class MonQTask(MappedClass):
- task_name - full dotted name of the task function to run
- process - identifier for which taskd process is working on the task
- context - values used to set c.project, c.app, c.user for the task
- - args - *args to be sent to the task function
- - kwargs - **kwargs to be sent to the task function
+ - args - ``*args`` to be sent to the task function
+ - kwargs - ``**kwargs`` to be sent to the task function
- result - if the task is complete, the return value. If in error, the traceback.
'''
states = ('ready', 'busy', 'error', 'complete', 'skipped')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index cbacc3a..d0e9f29 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -18,11 +18,13 @@
'''Manage notifications and subscriptions
When an artifact is modified:
+
- Notification generated by tool app
- Search is made for subscriptions matching the notification
- Notification is added to each matching subscriptions' queue
Periodically:
+
- For each subscriptions with notifications and direct delivery:
- For each notification, enqueue as a separate email message
- Clear subscription's notification list
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 21b4792..26291be 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -158,6 +158,11 @@ class ProjectMapperExtension(MapperExtension):
class Project(MappedClass, ActivityNode, ActivityObject):
+ '''
+ Projects contain tools, subprojects, and their own metadata. They live
+ in exactly one :class:`~allura.model.neighborhood.Neighborhood`
+ '''
+
_perms_base = ['read', 'update', 'admin', 'create']
_perms_init = _perms_base + ['register']
@@ -544,7 +549,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
return new_tools
def grouped_navbar_entries(self):
- """Return a ``allura.app.SitemapEntry`` list suitable for rendering
+ """Return a :class:`~allura.app.SitemapEntry` list suitable for rendering
the project navbar with tools grouped together by tool type.
"""
# get orginal (non-grouped) navbar entries
@@ -967,7 +972,7 @@ class AppConfig(MappedClass, ActivityObject):
"""
Configuration information for an instantiated :class:`Application <allura.app.Application>`
- in a project
+ in a :class:`Project`
:var options: an object on which various options are stored. options.mount_point is the url component for this app instance
:var acl: a dict that maps permissions (strings) to lists of roles that have the permission
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index ed059a9..7530221 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -69,6 +69,9 @@ class ActivityNode(NodeBase):
class ActivityObject(ActivityObjectBase):
+ '''
+ Allura's base activity class.
+ '''
@property
def activity_name(self):
@@ -113,10 +116,11 @@ class TransientActor(NodeBase, ActivityObjectBase):
def perm_check(user):
+ """
+ Return a function that returns True if ``user`` has 'read' access to a given activity,
+ otherwise returns False.
+ """
def _perm_check(activity):
- """Return True if c.user has 'read' access to this activity,
- otherwise return False.
- """
extras_dict = activity.obj.activity_extras
if not extras_dict:
return True
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/allura/model/types.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/types.py b/Allura/allura/model/types.py
index 12df733..be4b48e 100644
--- a/Allura/allura/model/types.py
+++ b/Allura/allura/model/types.py
@@ -33,8 +33,15 @@ class MarkdownCache(S.Object):
class ACE(S.Object):
+ '''
+ Access Control Entry
+
+ :var access: either ``ACE.ALLOW`` or ``ACE.DENY``
+ :var str reason: optional, user-entered text
+ :var role_id: _id for a :class:`~allura.model.auth.ProjectRole`
+ :var str permission: e.g. 'read', 'create', etc
+ '''
- '''ACE - access control entry'''
ALLOW, DENY = 'ALLOW', 'DENY'
def __init__(self, permissions, **kwargs):
@@ -75,6 +82,9 @@ class ACE(S.Object):
class ACL(S.Array):
+ '''
+ Access Control List. Is an array of :class:`ACE`
+ '''
def __init__(self, permissions=None, **kwargs):
super(ACL, self).__init__(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/lib/security.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/lib/security.rst b/Allura/docs/api/lib/security.rst
index eb8ead3..08c9ba4 100644
--- a/Allura/docs/api/lib/security.rst
+++ b/Allura/docs/api/lib/security.rst
@@ -15,8 +15,6 @@
specific language governing permissions and limitations
under the License.
-.. _spam_module:
-
:mod:`allura.lib.security`
-------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model.rst b/Allura/docs/api/model.rst
index 363b85e..55cb5e4 100644
--- a/Allura/docs/api/model.rst
+++ b/Allura/docs/api/model.rst
@@ -20,40 +20,9 @@
:mod:`allura.model`
--------------------------------
-.. automodule:: allura.model
+.. toctree::
+ :maxdepth: 1
+ :glob:
- .. automodule:: allura.model.artifact
-
- .. autoclass:: Artifact
- :members:
- :special-members: __json__
-
- .. autoclass:: Snapshot
- :members:
-
- .. autoclass:: VersionedArtifact
- :members:
-
- .. autoclass:: Message
- :members:
-
- .. autoclass:: Feed
- :members:
-
- .. autoclass:: VotableArtifact
- :members:
-
- .. autoclass:: MovedArtifact
- :members:
-
- .. automodule:: allura.model.auth
-
- .. autoclass:: User
- :members:
-
- .. autoclass:: ProjectRole
- :members:
-
- .. autoclass:: AuditLog
- :members:
+ model/*
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/artifact.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/artifact.rst b/Allura/docs/api/model/artifact.rst
new file mode 100644
index 0000000..0b6b217
--- /dev/null
+++ b/Allura/docs/api/model/artifact.rst
@@ -0,0 +1,43 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.artifact`
+-------------------------------------
+
+.. automodule:: allura.model.artifact
+
+ .. autoclass:: Artifact
+ :members:
+ :special-members: __json__
+
+ .. autoclass:: Snapshot
+ :members:
+
+ .. autoclass:: VersionedArtifact
+ :members:
+
+ .. autoclass:: Message
+ :members:
+
+ .. autoclass:: Feed
+ :members:
+
+ .. autoclass:: VotableArtifact
+ :members:
+
+ .. autoclass:: MovedArtifact
+ :members:
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/auth.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/auth.rst b/Allura/docs/api/model/auth.rst
new file mode 100644
index 0000000..c25a8f7
--- /dev/null
+++ b/Allura/docs/api/model/auth.rst
@@ -0,0 +1,30 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.auth`
+-------------------------------------
+
+.. automodule:: allura.model.auth
+
+ .. autoclass:: User
+ :members:
+
+ .. autoclass:: ProjectRole
+ :members:
+
+ .. autoclass:: AuditLog
+ :members:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/monq_model.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/monq_model.rst b/Allura/docs/api/model/monq_model.rst
new file mode 100644
index 0000000..2d0a359
--- /dev/null
+++ b/Allura/docs/api/model/monq_model.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.monq_model`
+-------------------------------------
+
+.. automodule:: allura.model.monq_model
+ :members:
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/neighborhood.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/neighborhood.rst b/Allura/docs/api/model/neighborhood.rst
new file mode 100644
index 0000000..8eb82dd
--- /dev/null
+++ b/Allura/docs/api/model/neighborhood.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.neighborhood`
+-------------------------------------
+
+.. automodule:: allura.model.neighborhood
+ :members:
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/notification.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/notification.rst b/Allura/docs/api/model/notification.rst
new file mode 100644
index 0000000..a6eac74
--- /dev/null
+++ b/Allura/docs/api/model/notification.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.notification`
+-------------------------------------
+
+.. automodule:: allura.model.notification
+ :members:
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/project.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/project.rst b/Allura/docs/api/model/project.rst
new file mode 100644
index 0000000..1e2a16f
--- /dev/null
+++ b/Allura/docs/api/model/project.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.project`
+-------------------------------------
+
+.. automodule:: allura.model.project
+ :members:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/session.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/session.rst b/Allura/docs/api/model/session.rst
new file mode 100644
index 0000000..626ce03
--- /dev/null
+++ b/Allura/docs/api/model/session.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.session`
+-------------------------------------
+
+.. automodule:: allura.model.session
+ :members:
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/timeline.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/timeline.rst b/Allura/docs/api/model/timeline.rst
new file mode 100644
index 0000000..2caeb29
--- /dev/null
+++ b/Allura/docs/api/model/timeline.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.timeline`
+-------------------------------------
+
+.. automodule:: allura.model.timeline
+ :members:
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2a44a8ef/Allura/docs/api/model/types.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model/types.rst b/Allura/docs/api/model/types.rst
new file mode 100644
index 0000000..e77dbf3
--- /dev/null
+++ b/Allura/docs/api/model/types.rst
@@ -0,0 +1,22 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+:mod:`allura.model.types`
+-------------------------------------
+
+.. automodule:: allura.model.types
+ :members:
\ No newline at end of file
[2/2] git commit: [#7173] improve auth docs;
expose auth and more artifact model docs
Posted by tv...@apache.org.
[#7173] improve auth docs; expose auth and more artifact model docs
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3b88949d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3b88949d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3b88949d
Branch: refs/heads/master
Commit: 3b88949d44f92ae0629c4d8b0f570741d00653d7
Parents: 8a6bf21
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Feb 13 11:59:55 2014 -0500
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Feb 21 17:55:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/security.py | 28 +++++++++++++++++++---------
Allura/allura/model/auth.py | 4 ++--
Allura/docs/api/lib/security.rst | 28 ++++++++++++++++++++++++++++
Allura/docs/api/model.rst | 31 +++++++++++++++++++++++++++++++
Allura/docs/index.rst | 30 +++++++++++++++---------------
5 files changed, 95 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3b88949d/Allura/allura/lib/security.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/security.py b/Allura/allura/lib/security.py
index a328197..c966e34 100644
--- a/Allura/allura/lib/security.py
+++ b/Allura/allura/lib/security.py
@@ -43,13 +43,15 @@ class Credentials(object):
@property
def project_role(self):
+ # bypass Ming model validation and use pymongo directly
+ # for improved performance
from allura import model as M
db = M.session.main_doc_session.db
return db[M.ProjectRole.__mongometa__.name]
@classmethod
def get(cls):
- 'get the global Credentials instance'
+ 'get the global :class:`Credentials` instance'
import allura
return allura.credentials
@@ -113,7 +115,7 @@ class Credentials(object):
def project_roles(self, project_id):
'''
- :returns: a RoleCache of ProjectRoles for project_id
+ :returns: a :class:`RoleCache` of :class:`ProjectRoles <allura.model.auth.ProjectRole>` for project_id
'''
roles = self.projects.get(project_id)
if roles is None:
@@ -123,7 +125,7 @@ class Credentials(object):
def user_roles(self, user_id, project_id=None):
'''
- :returns: a RoleCache of ProjectRoles for given user_id and project_id, *anonymous and *authenticated checked as appropriate
+ :returns: a :class:`RoleCache` of :class:`ProjectRoles <allura.model.auth.ProjectRole>` for given user_id and optional project_id, ``*anonymous`` and ``*authenticated`` checked as appropriate
'''
roles = self.users.get((user_id, project_id))
if roles is None:
@@ -154,8 +156,15 @@ class Credentials(object):
class RoleCache(object):
+ '''
+ An iterable collection of :class:`ProjectRoles <allura.model.auth.ProjectRole>` that is cached after first use
+ '''
def __init__(self, cred, q):
+ '''
+ :param `Credentials` cred: :class:`Credentials`
+ :param iterable q: An iterable (e.g a query) of :class:`ProjectRoles <allura.model.auth.ProjectRole>`
+ '''
self.cred = cred
self.q = q
@@ -364,24 +373,25 @@ def all_allowed(obj, user_or_role=None, project=None):
'''
List all the permission names that a given user or named role
is allowed for a given object. This list reflects the permissions
- for which has_access() would return True for the user (or a user
+ for which ``has_access()`` would return True for the user (or a user
in the given named role, e.g. Developer).
Example:
- Given a tracker with the following ACL (pseudo-code):
+ Given a tracker with the following ACL (pseudo-code)::
+
[
ACE.allow(ProjectRole.by_name('Developer'), 'create'),
ACE.allow(ProjectRole.by_name('Member'), 'post'),
ACE.allow(ProjectRole.by_name('*anonymous'), 'read'),
]
- And user1 is in the Member group, then all_allowed(tracker, user1)
- will return:
+ And user1 is in the Member group, then ``all_allowed(tracker, user1)``
+ will return::
set(['post', 'read'])
- And all_allowed(tracker, ProjectRole.by_name('Developer')) will return:
+ And ``all_allowed(tracker, ProjectRole.by_name('Developer'))`` will return::
set(['create', 'post', 'read'])
'''
@@ -430,7 +440,7 @@ def all_allowed(obj, user_or_role=None, project=None):
def require(predicate, message=None):
'''
- Example: require(has_access(c.app, 'read'))
+ Example: ``require(has_access(c.app, 'read'))``
:param callable predicate: truth function to call
:param str message: message to show upon failure
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3b88949d/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index f9e3a4c..357afe8 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -556,7 +556,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
def url(self):
'''
Return the URL (relative to root domain) for this user's user-project.
- This includes any special handling via the Auth Provider to determine the proper user-project name
+ This includes any special handling via the :class:`~allura.lib.plugin.AuthenticationProvider` to determine the proper user-project name
'''
return '/%s/' % plugin.AuthenticationProvider.get(request).user_project_shortname(self)
@@ -772,7 +772,7 @@ class ProjectRole(MappedClass):
:var user_id: used if this role is for a single user
:var project_id:
:var name:
- :var roles: a list of other ProjectRole objectids
+ :var roles: a list of other :class:`ProjectRole` ``ObjectId`` values. These roles are delegated through the current role.
"""
class __mongometa__:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3b88949d/Allura/docs/api/lib/security.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/lib/security.rst b/Allura/docs/api/lib/security.rst
new file mode 100644
index 0000000..eb8ead3
--- /dev/null
+++ b/Allura/docs/api/lib/security.rst
@@ -0,0 +1,28 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _spam_module:
+
+:mod:`allura.lib.security`
+-------------------------------------
+
+.. automodule:: allura.lib.security
+ :members:
+
+ .. autoclass:: RoleCache
+ :members:
+ :special-members: __init__
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3b88949d/Allura/docs/api/model.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/model.rst b/Allura/docs/api/model.rst
index 2d30d1d..363b85e 100644
--- a/Allura/docs/api/model.rst
+++ b/Allura/docs/api/model.rst
@@ -26,3 +26,34 @@
.. autoclass:: Artifact
:members:
+ :special-members: __json__
+
+ .. autoclass:: Snapshot
+ :members:
+
+ .. autoclass:: VersionedArtifact
+ :members:
+
+ .. autoclass:: Message
+ :members:
+
+ .. autoclass:: Feed
+ :members:
+
+ .. autoclass:: VotableArtifact
+ :members:
+
+ .. autoclass:: MovedArtifact
+ :members:
+
+ .. automodule:: allura.model.auth
+
+ .. autoclass:: User
+ :members:
+
+ .. autoclass:: ProjectRole
+ :members:
+
+ .. autoclass:: AuditLog
+ :members:
+
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3b88949d/Allura/docs/index.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/index.rst b/Allura/docs/index.rst
index 98fc5cb..14c121b 100644
--- a/Allura/docs/index.rst
+++ b/Allura/docs/index.rst
@@ -47,21 +47,6 @@ Using Allura
using
-Developing Allura
-=====================================================================
-
-.. toctree::
- :maxdepth: 3
-
- contributing
- platform
- platform_tour
- guides/message_bus
- guides/email
- guides/permissions
- tutorials/testing
-
-
Extending Allura
=====================================================================
@@ -77,6 +62,21 @@ Extending Allura
* `Adding a Sidebar Menu <https://sourceforge.net/u/vansteenburgh/allura-plugin-development/2013/12/adding-a-sidebar-menu/>`_
* `Adding Custom CSS <https://sourceforge.net/u/vansteenburgh/allura-plugin-development/2013/12/part-5-adding-custom-css/>`_
+Developing Allura
+=====================================================================
+
+.. toctree::
+ :maxdepth: 3
+
+ contributing
+ platform
+ platform_tour
+ guides/message_bus
+ guides/email
+ guides/permissions
+ tutorials/testing
+
+
API Documentation
==================