mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 20:48:31 +08:00
Dev api 240111 (#377)
* feat(api): My subscription supports CIType sorting * feat(api): db change
This commit is contained in:
@@ -465,16 +465,16 @@ class CITypeGrantView(APIView):
|
||||
|
||||
acl.grant_resource_to_role_by_rid(type_name, rid, ResourceTypeEnum.CI_TYPE, perms, rebuild=False)
|
||||
|
||||
resource = None
|
||||
if 'ci_filter' in request.values or 'attr_filter' in request.values:
|
||||
CIFilterPermsCRUD().add(type_id=type_id, rid=rid, **request.values)
|
||||
else:
|
||||
resource = CIFilterPermsCRUD().add(type_id=type_id, rid=rid, **request.values)
|
||||
|
||||
if not resource:
|
||||
from api.tasks.acl import role_rebuild
|
||||
from api.lib.perm.acl.const import ACL_QUEUE
|
||||
|
||||
app_id = AppCache.get('cmdb').id
|
||||
current_app.logger.info((rid, app_id))
|
||||
role_rebuild.apply_async(args=(rid, app_id), queue=ACL_QUEUE)
|
||||
current_app.logger.info('done')
|
||||
|
||||
return self.jsonify(code=200)
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
from flask import abort
|
||||
from flask import current_app
|
||||
from flask import request
|
||||
|
||||
from api.lib.cmdb.ci_type import CITypeManager
|
||||
@@ -187,3 +188,15 @@ class PreferenceRelationRevokeView(APIView):
|
||||
acl.revoke_resource_from_role_by_rid(name, rid, ResourceTypeEnum.RELATION_VIEW, perms)
|
||||
|
||||
return self.jsonify(code=200)
|
||||
|
||||
|
||||
class PreferenceCITypeOrderView(APIView):
|
||||
url_prefix = ("/preference/ci_types/order",)
|
||||
|
||||
def post(self):
|
||||
type_ids = request.values.get("type_ids")
|
||||
is_tree = request.values.get("is_tree") in current_app.config.get('BOOL_TRUE')
|
||||
|
||||
PreferenceManager.upsert_ci_type_order(type_ids, is_tree)
|
||||
|
||||
return self.jsonify(type_ids=type_ids, is_tree=is_tree)
|
||||
|
Reference in New Issue
Block a user