launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #07223
Grokking our security definitions: debug_proxy
Hi,
This is actually old news, but I'm sure not many of you know about it, or have
forgotten about it.
Ever wondered which attributes are protected on an instance and by which
permission? You can use debug_proxy to get the information you need.
Example make harness session:
francis@Casteneda:~/canonical/launchpad/bug-365098$ make harness
bin/harness
execute_zcml_for_scripts()...
Reading $PYTHONSTARTUP...
Initializing storm...
Creating the factory...
>>> from lp.registry.interfaces.distribution import IDistributionSet
>>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
>>> evolution = ubuntu.currentseries.getSourcePackage('evolution')
>>> from lazr.restful.debug import debug_proxy
>>> debug_proxy(evolution)
'zope.security._proxy._Proxy (using zope.security.checker.Checker)\n
public: __eq__, __getitem__, __hash__, __ne__, _getOfficialTagClause,
all_bugtasks, bug_reported_acknowledgement, bug_reporting_guidelines,
bugtargetdisplayname, bugtargetname, bugtasks, closed_bugtasks, createBug,
critical_bugtasks, currentrelease, deletePackaging, development_version,
direct_packaging, displayname, distinctreleases, distribution,
distribution_sourcepackage, distroseries, enable_bugfiling_duplicate_search,
format, getBranch, getBranches, getBugCounts, getBugTaskWeightFunction,
getBuildRecords, getCurrentTemplatesCollection, getCurrentTranslationFiles,
getCurrentTranslationTemplates, getFirstEntryToImport,
getLatestTranslationsUploads, getMergeProposals, getPocketPath,
getSharingDetailPermissions, getSharingPartner, getSuiteSourcePackage,
getTemplatesAndLanguageCounts, getTemplatesCollection,
getTranslationImportQueueEntries, getTranslationTemplateByName,
getTranslationTemplateFormats, getTranslationTemplates, getUsedBugTags,
getUsedBugTagsWithOpenCounts, get_default_archive, has_bugtasks,
has_current_translation_templates, has_obsolete_translation_templates,
has_sharing_translation_templates, has_translation_files,
has_translation_templates, high_bugtasks, id, inprogress_bugtasks,
latest_published_component, latest_published_component_name, linkedBranches,
linked_branches, max_bug_heat, name, newCodeImport, new_bugtasks,
official_bug_tags, open_bugtasks, packaging, path, product, productseries,
published_by_pocket, recalculateBugHeatCache, releases, searchTasks,
setBranch, setMaxBugHeat, setPackaging,
setPackagingReturnSharingDetailPermissions, shouldimport, sourcepackagename,
summary, title, unassigned_bugtasks\n'
Enjoy!
--
Francis J. Lacoste
francis.lacoste@xxxxxxxxxxxxx
Attachment:
signature.asc
Description: This is a digitally signed message part.
Follow ups