Commit 303a9d42 by aa.gusti

edit permissions

1 parent 3712cdd8
...@@ -470,7 +470,7 @@ def get_route_names(rows): ...@@ -470,7 +470,7 @@ def get_route_names(rows):
def get_children(rows): def get_children(rows):
log.debug(f"Children: {rows}") # log.debug(f"Children: {rows}")
return [dict( return [dict(
order_id=r.order_id, order_id=r.order_id,
id=r.id, id=r.id,
...@@ -490,7 +490,7 @@ def get_module_menus(module): ...@@ -490,7 +490,7 @@ def get_module_menus(module):
Route.parent_id == None) Route.parent_id == None)
result = get_children(query.order_by(Route.order_id)) result = get_children(query.order_by(Route.order_id))
log.debug(result) # log.debug(result)
return result return result
......
...@@ -207,11 +207,11 @@ class Views(BaseView): ...@@ -207,11 +207,11 @@ class Views(BaseView):
term = 'term' in params and params['term'] or '' term = 'term' in params and params['term'] or ''
q = Route.query(). \ q = Route.query(). \
filter(Route.status == 1, filter(Route.status == 1,
Route.nama.ilike('%%%s%%' % term)) \ Route.kode.ilike('%%%s%%' % term)) \
.order_by(Route.nama) .order_by(Route.kode)
r = [] r = []
for k in q.all(): for k in q.all():
d = dict(id=k.id, value=k.nama, kode=k.kode, nama=k.nama) d = dict(id=k.id, value=k.kode, kode=k.kode, nama=k.nama)
r.append(d) r.append(d)
return r return r
...@@ -222,7 +222,7 @@ class Views(BaseView): ...@@ -222,7 +222,7 @@ class Views(BaseView):
values = super().get_values(row, istime, null) values = super().get_values(row, istime, null)
if row.parent_id: if row.parent_id:
route = Route.query_id(row.parent_id).first() route = Route.query_id(row.parent_id).first()
values["parent_nm"] = route and route.nama or "" values["parent_nm"] = route and route.kode or ""
_logging.debug(values) _logging.debug(values)
return values return values
......
...@@ -206,7 +206,8 @@ class ExternalIdentity(ExternalIdentityMixin, CommonModel, Base): ...@@ -206,7 +206,8 @@ class ExternalIdentity(ExternalIdentityMixin, CommonModel, Base):
class Permission(Base, CommonModel): class Permission(Base, CommonModel):
__tablename__ = 'permissions' __tablename__ = 'permissions'
__table_args__ = {'extend_existing': True, } __table_args__ = ({'extend_existing': True, },
TABLE_ARGS)
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
perm_name = Column(String(64), nullable=False, unique=True) perm_name = Column(String(64), nullable=False, unique=True)
description = Column(String(64), nullable=False, unique=True) description = Column(String(64), nullable=False, unique=True)
...@@ -237,4 +238,4 @@ def init_model(): ...@@ -237,4 +238,4 @@ def init_model():
ziggurat_model_init(User, Group, UserGroup, GroupPermission, UserPermission, ziggurat_model_init(User, Group, UserGroup, GroupPermission, UserPermission,
UserResourcePermission, GroupResourcePermission, UserResourcePermission, GroupResourcePermission,
Resource, Resource,
ExternalIdentity, passwordmanager=None) ExternalIdentity, passwordmanager=None)
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!