allura.model.project

class allura.model.project.AppConfig

Configuration information for an instantiated Application in a Project

Variables:
  • options – an object on which various options are stored. options.mount_point is the url component for this app instance
  • acl – a dict that maps permissions (strings) to lists of roles that have the permission
load()
Returns:the related Application class
parent_security_context()

ACL processing should terminate at the AppConfig

url(project=None)

return the URL for the app config. project parameter is for optimization

class allura.model.project.Project

Projects contain tools, subprojects, and their own metadata. They live in exactly one Neighborhood

classmethod accolades_index(projects)

Return a dict[project_id] = list of accolades, efficiently

add_user(user, role_names)

Convenience method to add member with the given role(s).

admins()

Find all the users who have ‘Admin’ role for this project

all_troves()

Returns a dict of human-readable root troves => [categories]

bulk_export_filename()

Return a filename (configurable) for this project export. The current timestamp may be included, so only run this method once per export.

bulk_export_status()

Returns ‘busy’ if an export is queued or in-progress. Returns None otherwise

grouped_navbar_entries()

Return a SitemapEntry list suitable for rendering the project navbar with tools grouped together by tool type.

classmethod icon_urls(projects)

Return a dict[project_id] = icon_url, efficiently

install_app(ep_name, mount_point=None, mount_label=None, ordinal=None, **override_options)

Install an app

Parameters:
  • ep_name (str) – Entry Point name, e.g. “wiki”
  • mount_point (str) – URL path, e.g. “docs”
  • mount_label (str) – Display name
  • ordinal (int) – location of tool, relative to others; None will go to the end.
  • override_options
Returns:

install_apps(apps_params)

Install many apps at once.

Better than doing individually if you expect default name conflicts (e.g. “code” for both git & svn), by using the tool_label value.

Parameters:apps_params (list) – list of dicts, where each dict is the args used in install_app()
classmethod menus(projects)

Return a dict[project_id] = sitemap of sitemaps, efficiently

next_mount_point(include_hidden=False)

Return the ordinal of the next open toolbar mount point for this project.

ordered_mounts(include_hidden=False)

Returns an array of a projects mounts (tools and sub-projects) in toolbar order. Note that the top-level ‘ordinal’ field may be offset from the stored ordinal value, due to anchored tools

parent_security_context()

ACL processing should proceed up the project hierarchy.

private

Return True if this project is private, else False.

should_update_index(old_doc, new_doc)

Skip index update if only last_updated has changed.

Value of last_updated is updated whenever any artifact that belongs to project is changed. This generates a lot of unnecessary add_projects tasks for every simple user action.

sitemap(excluded_tools=None, included_tools=None, tools_only=False, per_tool_limit=10)

Return the project sitemap.

Parameters:
  • excluded_tools (list) – Tool names (AppConfig.tool_name) to exclude from sitemap.
  • included_tools (list) – Tool names (AppConfig.tool_name) to include. Use None to include all tool types.
  • tools_only (bool) – Only include tools in the sitemap (exclude subprojects).
  • per_tool_limit (int) – Max number of entries included in the sitemap for a single tool type. Use None to include all.
users()

Find all the users who have named roles for this project

users_with_role(*role_names)

Return all users in this project that have at least one of the roles specified.

e.g., project.users_with_role(‘Admin’, ‘Developer’) -> returns all
users in project having the Admin role or the Developer role, or both