def public(self): """ Check the project visibility :returns: True if project is considered public (wide permissions), otherwise False """ groupstore = CQDEUserGroupStore(self.trac_environment_key) return groupstore.is_public_project()
def expand_macro(self, formatter, name, content, args=None): """ Returns the outcome from macro. Supported arguments: - project: Name of the project to show status / provide follow buttons. Defaults to current project """ req = formatter.req # Load project from db project = Project.get(self.env) # Get project metadata (categories) (combined_categories, separated_categories_per_context, context_by_id, context_order, languages) = self._get_project_categories(project) # Get project visibility: public or private ug = CQDEUserGroupStore(project.trac_environment_key) visibility = _('Public') if ug.is_public_project() else _('Private') # Return rendered HTML with JS attached to it data = { '_project_': project, 'combined_categories': combined_categories, 'separated_categories_per_context': separated_categories_per_context, 'context_order': context_order, 'languages': languages, 'context_by_id': context_by_id, 'visibility_label': visibility, # Private / Public 'to_web_time': to_web_time # TODO: Is this really required? } chrome = Chrome(self.env) stream = chrome.render_template(req, 'multiproject_summary.html', data, fragment=True) if req.form_token: stream |= chrome._add_form_token(req.form_token) return stream