• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python common.unquote_user_host函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中trove.extensions.mysql.common.unquote_user_host函数的典型用法代码示例。如果您正苦于以下问题:Python unquote_user_host函数的具体用法?Python unquote_user_host怎么用?Python unquote_user_host使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unquote_user_host函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: delete

 def delete(self, req, tenant_id, instance_id, id):
     LOG.info(_("Delete instance '%(id)s'\n"
                "req : '%(req)s'\n\n") %
              {"id": instance_id, "req": req})
     context = req.environ[wsgi.CONTEXT_KEY]
     id = correct_id_with_req(id, req)
     username, host = unquote_user_host(id)
     context.notification = notification.DBaaSUserDelete(context,
                                                         request=req)
     with StartNotification(context, instance_id=instance_id,
                            username=username):
         user = None
         try:
             user = guest_models.MySQLUser()
             user.name = username
             user.host = host
             found_user = models.User.load(context, instance_id, username,
                                           host)
             if not found_user:
                 user = None
         except (ValueError, AttributeError) as e:
             raise exception.BadRequest(msg=str(e))
         if not user:
             raise exception.UserNotFound(uuid=id)
         models.User.delete(context, instance_id, user.serialize())
     return wsgi.Result(None, 202)
开发者ID:Hopebaytech,项目名称:trove,代码行数:26,代码来源:service.py


示例2: update

 def update(self, req, body, tenant_id, instance_id, id):
     """Change attributes for one user."""
     LOG.info(_("Updating user attributes for instance '%(id)s'\n"
                "req : '%(req)s'\n\n") %
              {"id": instance_id, "req": strutils.mask_password(req)})
     context = req.environ[wsgi.CONTEXT_KEY]
     id = correct_id_with_req(id, req)
     username, hostname = unquote_user_host(id)
     user = None
     user_attrs = body['user']
     context.notification = notification.DBaaSUserUpdateAttributes(
         context, request=req)
     with StartNotification(context, instance_id=instance_id,
                            username=username):
         try:
             user = models.User.load(context, instance_id, username,
                                     hostname)
         except (ValueError, AttributeError) as e:
             raise exception.BadRequest(msg=str(e))
         if not user:
             raise exception.UserNotFound(uuid=id)
         try:
             models.User.update_attributes(context, instance_id, username,
                                           hostname, user_attrs)
         except (ValueError, AttributeError) as e:
             raise exception.BadRequest(msg=str(e))
     return wsgi.Result(None, 202)
开发者ID:Hopebaytech,项目名称:trove,代码行数:27,代码来源:service.py


示例3: _get_user

 def _get_user(self, context, instance_id, user_id):
     username, hostname = unquote_user_host(user_id)
     try:
         user = models.User.load(context, instance_id, username, hostname)
     except (ValueError, AttributeError) as e:
         raise exception.BadRequest(msg=str(e))
     if not user:
         raise exception.UserNotFound(uuid=user_id)
     return user
开发者ID:NeCTAR-RC,项目名称:trove,代码行数:9,代码来源:service.py


示例4: update

 def update(self, req, body, tenant_id, instance_id, user_id):
     """Grant access for a user to one or more databases."""
     LOG.info(_("Granting user access for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     user = self._get_user(context, instance_id, user_id)
     username, hostname = unquote_user_host(user_id)
     databases = [db['name'] for db in body['databases']]
     models.User.grant(context, instance_id, username, hostname, databases)
     return wsgi.Result(None, 202)
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:10,代码来源:service.py


示例5: index

 def index(self, req, tenant_id, instance_id, user_id):
     """Show permissions for the given user."""
     LOG.info(_("Showing user access for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     # Make sure this user exists.
     user = self._get_user(context, instance_id, user_id)
     username, hostname = unquote_user_host(user_id)
     access = models.User.access(context, instance_id, username, hostname)
     view = views.UserAccessView(access.databases)
     return wsgi.Result(view.data(), 200)
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:11,代码来源:service.py


示例6: update

 def update(self, req, body, tenant_id, instance_id, user_id):
     """Grant access for a user to one or more databases."""
     LOG.info(_("Granting user access for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     user = self._get_user(context, instance_id, user_id)
     if not user:
         LOG.error(_("No such user: %(user)s " % {'user': user}))
         raise exception.UserNotFound(uuid=user)
     username, hostname = unquote_user_host(user_id)
     databases = [db['name'] for db in body['databases']]
     models.User.grant(context, instance_id, username, hostname, databases)
     return wsgi.Result(None, 202)
开发者ID:jimbobhickville,项目名称:trove,代码行数:13,代码来源:service.py


示例7: delete

 def delete(self, req, tenant_id, instance_id, user_id, id):
     """Revoke access for a user."""
     LOG.info(_("Revoking user access for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     user = self._get_user(context, instance_id, user_id)
     username, hostname = unquote_user_host(user_id)
     access = models.User.access(context, instance_id, username, hostname)
     databases = [db.name for db in access.databases]
     if id not in databases:
         raise exception.DatabaseNotFound(uuid=id)
     models.User.revoke(context, instance_id, username, hostname, id)
     return wsgi.Result(None, 202)
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:13,代码来源:service.py


示例8: index

 def index(self, req, tenant_id, instance_id, user_id):
     """Show permissions for the given user."""
     LOG.info(_("Showing user access for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     # Make sure this user exists.
     user_id = correct_id_with_req(user_id, req)
     user = self._get_user(context, instance_id, user_id)
     if not user:
         LOG.error(_("No such user: %(user)s ") % {'user': user})
         raise exception.UserNotFound(uuid=user)
     username, hostname = unquote_user_host(user_id)
     access = models.User.access(context, instance_id, username, hostname)
     view = views.UserAccessView(access.databases)
     return wsgi.Result(view.data(), 200)
开发者ID:NeCTAR-RC,项目名称:trove,代码行数:15,代码来源:service.py


示例9: show

 def show(self, req, tenant_id, instance_id, id):
     """Return a single user."""
     LOG.info(_("Showing a user for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     username, host = unquote_user_host(id)
     user = None
     try:
         user = models.User.load(context, instance_id, username, host)
     except (ValueError, AttributeError) as e:
         raise exception.BadRequest(msg=str(e))
     if not user:
         raise exception.UserNotFound(uuid=id)
     view = views.UserView(user)
     return wsgi.Result(view.data(), 200)
开发者ID:jimbobhickville,项目名称:trove,代码行数:15,代码来源:service.py


示例10: delete_all

 def delete_all(self, req, tenant_id, instance_id, user_id):
     """Revoke all db access for a user."""
     LOG.info(_("Revoking user access to all dbs for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     user_id = correct_id_with_req(user_id, req)
     user = self._get_user(context, instance_id, user_id)
     if not user:
         LOG.error(_("No such user: %(user)s ") % {'user': user})
         raise exception.UserNotFound(uuid=user)
     username, hostname = unquote_user_host(user_id)
     access = models.User.access(context, instance_id, username, hostname)
     databases = [db.name for db in access.databases]
     #if id not in databases:
     #    raise exception.DatabaseNotFound(uuid=id)
     for id in databases:
         models.User.revoke(context, instance_id, username, hostname, id)
     return wsgi.Result(None, 202)
开发者ID:CMSS-BCRDB,项目名称:RDSV1.0,代码行数:18,代码来源:service.py


示例11: delete

 def delete(self, req, tenant_id, instance_id, id):
     LOG.info(_("Deleting user for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     username, host = unquote_user_host(id)
     user = None
     try:
         user = guest_models.MySQLUser()
         user.name = username
         user.host = host
         found_user = models.User.load(context, instance_id, username,
                                       host)
         if not found_user:
             user = None
     except (ValueError, AttributeError) as e:
         raise exception.BadRequest(msg=str(e))
     if not user:
         raise exception.UserNotFound(uuid=id)
     models.User.delete(context, instance_id, user.serialize())
     return wsgi.Result(None, 202)
开发者ID:jimbobhickville,项目名称:trove,代码行数:20,代码来源:service.py



注:本文中的trove.extensions.mysql.common.unquote_user_host函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python strcred.makeChecker函数代码示例发布时间:2022-05-27
下一篇:
Python models.load_and_verify函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap