Ignore:
Timestamp:
21.07.2010 22:19:32 (22 months ago)
Author:
zmsdev
Message:

Added support for defaults of mandatory sub-objects, insert-commands and programmatic zexp import.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ZMS/trunk/zmsobject.py

    r1031 r1122  
    957957    #  ZMSObject.filtered_command_actions: 
    958958    # -------------------------------------------------------------------------- 
    959     def filtered_command_actions(self, path, REQUEST): 
     959    def filtered_command_actions(self, path, REQUEST, insert_actions=False): 
    960960      actions = [] 
    961961      auth_user = REQUEST['AUTHENTICATED_USER'] 
     
    964964      for metaCmdId in self.getMetaCmdIds(): 
    965965        metaCmd = self.getMetaCmd(metaCmdId) 
    966         hasMetaType = self.meta_id in metaCmd['meta_types'] 
    967         hasRole = False 
    968         hasRole = hasRole or len(self.intersection_list(self.getUserRoles(auth_user),metaCmd['roles'])) > 0 
    969         hasRole = hasRole or auth_user.has_role('Manager') 
    970         if hasMetaType and hasRole: 
    971           actions.append((metaCmd['name'],path+'manage_executeMetacmd')) 
     966        if (insert_actions and metaCmd['id'].startswith('manage_add')) or \ 
     967           (not insert_actions and not metaCmd['id'].startswith('manage_add')): 
     968          hasMetaType = self.meta_id in metaCmd['meta_types'] 
     969          hasRole = False 
     970          hasRole = hasRole or len(self.intersection_list(self.getUserRoles(auth_user),metaCmd['roles'])) > 0 
     971          hasRole = hasRole or auth_user.has_role('Manager') 
     972          if hasMetaType and hasRole: 
     973            actions.append((metaCmd['name'],path+'manage_executeMetacmd')) 
    972974       
    973975      # Return action list. 
Note: See TracChangeset for help on using the changeset viewer.