mirror of
https://github.com/veops/cmdb.git
synced 2025-08-08 12:11:46 +08:00
前后端全面升级
This commit is contained in:
21
cmdb-api/api/lib/perm/acl/record.py
Normal file
21
cmdb-api/api/lib/perm/acl/record.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
from api.models.acl import OperationRecord
|
||||
|
||||
|
||||
class OperateRecordCRUD(object):
|
||||
@staticmethod
|
||||
def search(page, page_size, **kwargs):
|
||||
query = OperationRecord.get_by(only_query=True)
|
||||
for k, v in kwargs.items():
|
||||
if hasattr(OperationRecord, k) and v:
|
||||
query = query.filter(getattr(OperationRecord, k) == v)
|
||||
|
||||
numfound = query.count()
|
||||
res = query.offset((page - 1) * page_size).limit(page_size)
|
||||
|
||||
return numfound, res
|
||||
|
||||
@staticmethod
|
||||
def add(app, rolename, operate, obj):
|
||||
OperationRecord.create(app=app, rolename=rolename, operate=operate, obj=obj)
|
Reference in New Issue
Block a user