| | |
| | | |
| | | async def create_role(db, role_name: str, description: str, role_key, data_scope, user_id): |
| | | try: |
| | | role_model = RoleModel(id=str(uuid.uuid4()),name=role_name, description=description,creator=user_id, data_scope=data_scope) |
| | | role_model = RoleModel(id=str(uuid.uuid4()),name=role_name, description=description,creator=user_id, dataScope=data_scope) |
| | | if role_key: |
| | | role_model.roleKey = role_key |
| | | db.add(role_model) |
| | |
| | | if role_key: |
| | | role.roleKey = role_key |
| | | if data_scope: |
| | | role.data_scope = data_scope |
| | | role.dataScope = data_scope |
| | | else: |
| | | role.resources = [db.get(ResourceModel, resourcesId) for resourcesId in resources] |
| | | db.add(role) |