예제 #1
0
 def admin_group_edit(self):
     '''
     admin group page
     :return: template
     '''
     id = self.data.get_request_parameter("km_group_edit_id")
     self.result['menu_list'] = get_menu_list()
     self.result['group'] = KMGroup.get(id)
     self.result['groups'] = KMGroup.all()
예제 #2
0
 def admin_group_edit(self):
     '''
     admin group page
     :return: template
     '''
     id = self.data.get_request_parameter("km_group_edit_id")
     self.result['menu_list'] = get_menu_list()
     self.result['group'] = KMGroup.get(id)
     self.result['groups'] = KMGroup.all()
예제 #3
0
 def save_group(cls, data):
     id = data.get_request_parameter("id")
     delete = data.get_request_parameter("delete", default=None)
     if delete is None:
         group = KMGroup.get(id)
         group.set_data(data)
         group.save()
     else:
         KMGroup.delete_by_id(id)
예제 #4
0
 def admin_group_save(self):
     '''
     admin group page
     :return: template
     '''
     id = self.data.get_request_parameter("id")
     delete = self.data.get_request_parameter("delete", default=None)
     if delete is None:
         group = KMGroup.get(id)
         group.set_data(self.data)
         group.save()
     else:
         KMGroup.delete_by_id(id)
     self.result['menu_list'] = get_menu_list()
     self.result['groups'] = KMGroup.all()
예제 #5
0
 def admin_group_save(self):
     '''
     admin group page
     :return: template
     '''
     id = self.data.get_request_parameter("id");
     delete = self.data.get_request_parameter("delete", default=None);
     if delete is None:
         group = KMGroup.get(id)
         group.set_data(self.data)
         group.save()
     else:
         KMGroup.delete_by_id(id)
     self.result['menu_list'] = get_menu_list()
     self.result['groups'] = KMGroup.all()
예제 #6
0
 def admin_group(self):
     '''
     admin group page
     :return: template
     '''
     self.result['menu_list'] = get_menu_list()
     self.result['groups'] = KMGroup.all()
예제 #7
0
 def admin_group(self):
     '''
     admin group page
     :return: template
     '''
     self.result['menu_list'] = get_menu_list()
     self.result['groups'] = KMGroup.all()
예제 #8
0
 def admin_group_save(self):
     '''
     admin group page
     :return: template
     '''
     KMUserAdmin.save_group(self.data)
     self.result['menu_list'] = get_menu_list()
     self.result['groups'] = KMGroup.all()
예제 #9
0
 def admin_user_edit(self):
     '''
     admin user page
     :return: template
     '''
     id = self.data.get_request_parameter("km_user_edit_id")
     self.result['menu_list'] = get_menu_list()
     self.result['user'] = KMUser.get(id)
     self.result['groups'] = KMGroup.all()
     self.result['roles'] = KMRole.all()
예제 #10
0
 def admin_user_edit(self):
     '''
     admin user page
     :return: template
     '''
     id = self.data.get_request_parameter("km_user_edit_id")
     self.result['menu_list'] = get_menu_list()
     self.result['user'] = KMUser.get(id)
     self.result['groups'] = KMGroup.all()
     self.result['roles'] = KMRole.all()
예제 #11
0
def save_group():
    """
    Save the Group.
    will save the json string in the following formats.
    Format: 'keyName':{"hoge":"fuga"}

    """
    try:
        session = db_manager.get_session()
        for save_group in request.forms:
            json_data = json.loads(save_group.decode('utf-8'))
            for id in json_data:
                if json_data[id] == "":
                    group_delete(id, session)  # delete
                else:
                    group = KMGroup()
                    group.name = json_data[id]["name"]
                    group.parent_id = json_data[id]["parent_id"]
                    group_update(group, session)
    finally:
        session.close()