app/soc/logic/models/role.py
changeset 3052 6907a33ca0a2
parent 2676 a7fabd1534f8
equal deleted inserted replaced
3051:af30b338d191 3052:6907a33ca0a2
    69     self.role_name = role_name
    69     self.role_name = role_name
    70     registerRoleLogic(self)
    70     registerRoleLogic(self)
    71 
    71 
    72     self.disallow_last_resign = disallow_last_resign
    72     self.disallow_last_resign = disallow_last_resign
    73 
    73 
    74 
       
    75   def getGroupEntityFromScopePath(self, group_logic, scope_path):
       
    76     """Returns a group entity by using the given scope_path.
       
    77 
       
    78     Args:
       
    79       group_logic: logic for the group which should be retrieved
       
    80       scope_path : the scope path of the entity
       
    81     """
       
    82     group_key_fields = scope_path.rsplit('/', 1)
       
    83 
       
    84     if len(group_key_fields) == 1:
       
    85       # there is only a link_id
       
    86       fields = {'link_id' : group_key_fields[0]}
       
    87     else:
       
    88       # there is a scope_path and link_id
       
    89       fields = {'scope_path' : group_key_fields[0],
       
    90                 'link_id' : group_key_fields[1]}
       
    91 
       
    92     group = group_logic.getForFields(fields, unique=True)
       
    93 
       
    94     return group
       
    95 
       
    96   def _updateField(self, entity, entity_properties, name):
    74   def _updateField(self, entity, entity_properties, name):
    97     """Special logic for role. If status changes to active we flush the sidebar.
    75     """Special logic for role. If status changes to active we flush the sidebar.
    98     """
    76     """
    99 
    77 
   100     value = entity_properties[name]
    78     value = entity_properties[name]