acl done and bugfix

This commit is contained in:
pycook
2019-12-06 22:33:31 +08:00
parent 16b724bd40
commit f424ad6864
22 changed files with 270 additions and 138 deletions

View File

@@ -13,4 +13,4 @@ def role_rebuild(rids):
for rid in rids:
RoleRelationCache.rebuild(rid)
current_app.logger.info("%d rebuild.........." % rids)
current_app.logger.info("Role {0} rebuild..........".format(rids))

View File

@@ -50,8 +50,8 @@ def ci_relation_cache(parent_id, child_id):
children = json.loads(children) if children is not None else {}
cr = CIRelation.get_by(first_ci_id=parent_id, second_ci_id=child_id, first=True, to_dict=False)
if child_id not in children:
children[child_id] = cr.second_ci.type_id
if str(child_id) not in children:
children[str(child_id)] = cr.second_ci.type_id
rd.create_or_update({parent_id: json.dumps(children)}, REDIS_PREFIX_CI_RELATION)
@@ -63,8 +63,8 @@ def ci_relation_delete(parent_id, child_id):
children = rd.get([parent_id], REDIS_PREFIX_CI_RELATION)[0]
children = json.loads(children) if children is not None else {}
if child_id in children:
children.pop(child_id)
if str(child_id) in children:
children.pop(str(child_id))
rd.create_or_update({parent_id: json.dumps(children)}, REDIS_PREFIX_CI_RELATION)