The PEAK Developers' Center   ShortIntroPeakSecurity UserPreferences
HelpContents Search Diffs Info Edit Subscribe XML Print View
Version as of 2003-12-05 21:27:06

Clear message

1 Peak Security

Here's a brief example of how to use peak security.

1.1 A short example

from peak.api import * 
class Owner(security.Permission): 
class Building(object): 
        burnBuilding = Owner 
    def burnBuilding(self): 
            print "Burn baby burn" 
class buildingRules(security.RuleSet): 
    rules = Items( 
          checkCanBurn = [Owner.of(Building)] 
    def checkCanBurn(self, attempt): 
        if attempt.user is attempt.subject.owner: 
            return 1 
            return security.Denial( 
                 "You are not allowed to burn that building" 

EditText of this page (last modified 2003-12-05 21:27:06)
FindPage by browsing, title search , text search or an index
Or try one of these actions: AttachFile, DeletePage, LikePages, LocalSiteMap, SpellCheck