Changeset 4266

Show
Ignore:
Timestamp:
09/11/08 08:52:04 (2 months ago)
Author:
bobbysmith007
Message:

changed blackmagics permissions stuff to make sense and also made api do upgrades in the correct order

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • timingandestimationplugin/branches/trac0.11-Permissions/timingandestimationplugin/api.py

    r4265 r4266  
    5656        self.statuses_key = 'T&E-statuses' 
    5757        self.db_version_key = 'TimingAndEstimationPlugin_Db_Version' 
    58         self.db_version = 7 
     58        self.db_version = 8 
    5959        # Initialise database schema version tracking. 
    6060        self.db_installed_version = dbhelper.get_system_value(self, \ 
     
    114114        #version 6 upgraded reports 
    115115 
    116         # This statement block always goes at the end this method 
    117         dbhelper.set_system_value(self, self.db_version_key, self.db_version) 
    118         self.db_installed_version = self.db_version 
     116 
    119117        if self.db_installed_version < 7: 
    120118            field_settings = "field settings" 
     
    123121            self.config.set( field_settings, "hours.permission", "TIME_VIEW:remove, TIME_RECORD:disable" ) 
    124122            self.config.set( field_settings, "estimatedhours.permission", "TIME_RECORD:disable" ) 
     123 
     124        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     125        # This statement block always goes at the end this method 
     126        dbhelper.set_system_value(self, self.db_version_key, self.db_version) 
     127        self.db_installed_version = self.db_version 
     128        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    125129 
    126130             
  • timingandestimationplugin/branches/trac0.11-Permissions/timingandestimationplugin/blackmagic.py

    r4264 r4266  
    7575class TicketTweaks(Component): 
    7676    implements(ITemplateStreamFilter, ITemplateProvider, IPermissionRequestor)     
    77     permissions = ListOption(csection, 'permissions', []) 
    78     gray_disabled = Option(csection, 'gray_disabled', '',  
    79         doc="""If not set, disabled items will have their label striked through.  
    80         Otherwise, this color will be used to gray them out. Suggested #cccccc.""") 
    81     ## IPermissionRequestor methods 
    82      
     77 
    8378    def get_permission_actions(self): 
    84         return (x.upper() for x in self.permissions) 
     79        fields = self.config.getlist(csection, 'fields', []) 
     80        permissions = self.config.getlist(csection, 'permissions', []) 
     81        perms = [] 
     82        for field in fields: 
     83            perms.extend(self.config.getlist(csection, '%s.permission' % field, [])) 
     84        for (perm, denial) in [s.split(":") for s in perms]: 
     85            permissions.append(perm) 
     86        return (x.upper() for x in permissions) 
    8587     
    8688    ## ITemplateStreamFilter