def has_delete_permission(self, obj, data): return current_user.has_shop_access( obj.retail_shop_id) and current_user.has_permission( 'remove_brand_distributor')
def has_add_permission(self, obj, data): return current_user.organisation_id == User.query.with_entities(User.organisation_id) \ .filter(User.id == data['user_id']).scalar() and current_user.has_permission('add_user_role')
def has_delete_permission(self, obj): return current_user.has_store_access(obj.store_id) and current_user.has_permission('delete_printer_config')
def has_delete_permission(self, obj): if obj.organisation_id == current_user.organisation_id and current_user.has_permission('delete_customer'): return True return False
def has_delete_permission(self, obj): if current_user.has_permission('delete_user_stores') and current_user.has_store_access(obj.store_id): return True return False
def has_read_permission(self, qs): if current_user.has_permission('view_user_stores'): return qs.filter(self.model.store_id.in_(current_user.store_ids)).all()
def has_add_permission(self, obj, data): if current_user.has_permission('add_user_stores'): if not current_user.has_store_access(data['store_id']): return False return True return False
def has_change_permission(self, obj, data): if current_user.has_permission('change_user_shops') and current_user.has_shop_access(obj.retail_shop_id): return True return False
def has_add_permission(self, obj, data): if current_user.has_permission('add_user_shops'): if not current_user.has_shop_access(data['retail_shop_id']): return False return True return False
def has_add_permission(self, obj): return current_user.has_shop_access( obj.retail_shop_id) and current_user.has_permission( 'create_order_item')
def has_read_permission(self, qs): if current_user.has_permission('view_user_shops'): return qs.filter(self.model.retail_shop_id.in_(current_user.retail_shop_ids)).all()
def has_delete_permission(self, obj): return current_user.has_shop_access( obj.retail_shop_id) and current_user.has_permission( 'remove_order_item')
def has_read_permission(self, qs): if current_user.has_permission('view_order_item'): return qs.filter( self.model.retail_shop_id.in_(current_user.retail_shop_ids)) else: return qs.filter(false())
def has_add_permission(self, obj, data): if not current_user.has_permission('create_brand_distributor') or \ not current_user.has_shop_access(Product.query.with_entities(Brand.retail_shop_id) .filter(Brand.id == obj.brand_id).scalar()): return False return True
def has_add_permission(self, obj): if obj.retail_brand_id == current_user.retail_brand_id and current_user.has_permission('add_shop'): return True return False
def has_delete_permission(self, obj): if obj.retail_brand_id == current_user.retail_brand_id and current_user.has_permission('delete_customer'): return True return False
def has_add_permission(self, obj): if obj.organisation_id == current_user.organisation_id and current_user.has_permission('add_store'): return True return False
def has_delete_permission(self, obj): if current_user.has_permission('delete_user_shops') and current_user.has_shop_access(obj.retail_shop_id): return True return False
def has_change_permission(self, obj, data): if current_user.has_permission('change_user_stores') and current_user.has_store_access(obj.store_id): return True return False
def has_change_permission(self, obj, data): if current_user.has_permission('change_user_permissions') and \ current_user.retail_brand_id == User.query.with_entities(User.retail_brand_id)\ .filter(User.id == data['user_id']).scalar(): return True return False
def has_read_permission(self, qs): if current_user.has_permission('view_customer'): return qs.filter(self.model.organisation_id == current_user.organisation_id)
def has_delete_permission(self, obj, data): return current_user.retail_brand_id == User.query.with_entities(User.retail_brand_id) \ .filter(User.id == data['user_id']).scalar() and current_user.has_permission('delete_user_role')
def has_read_permission(self, qs): if current_user.has_permission('view_permission'): return qs.filter(or_(self.model.is_hidden.is_(False), self.model.is_hidden.is_(None))) return False
def has_change_permission(self, obj): return current_user.has_shop_access(obj.retail_shop_id) and current_user.has_permission('change_printer_config')
def has_delete_permission(self, obj, data): if current_user.has_permission('delete_user_permissions') and \ current_user.organisation_id == User.query.with_entities(User.organisation_id)\ .filter(User.id == data['user_id']).scalar(): return True return False
def has_delete_permission(self, obj): return current_user.has_shop_access(obj.retail_shop_id) and \ current_user.has_permission('delete_registration_detail')
def has_read_permission(self, qs): if current_user.has_permission('view_product_config'): return qs.filter(self.model.store_id.in_(current_user.store_ids)) return qs.filter(false())
def has_read_permission(self, qs): if current_user.has_permission('view_shop'): return qs.filter(self.model.retail_brand_id == current_user.retail_brand_id)
def has_read_permission(self, qs): if current_user.has_permission('view_registration_detail'): return qs.filter(self.model.store_id.in_(current_user.store_ids)) return qs.filter(false())
def has_read_permission(self, qs): if current_user.has_permission('view_brand_distributor'): return qs.filter( self.model.retail_shop_id.in_(current_user.retail_shop_ids)) return qs.filter(false())