- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何向 Cloudant 用户数据库中的用户添加 Angular 色?(_users)
我无法使用 Google 或 Cloudant Docs 解决这个问题。
我看到有人提到 Cloudant _user db,但还没有找到如何使用它。
我已经用 nodejs 和 express 构建了一个 API。
和
const { CloudantV1 } = require('@ibm-cloud/cloudant');
const { BasicAuthenticator } = require('ibm-cloud-sdk-core');
我能够创建 ApiKeys 并使用 service.putCloudantSecurityConfiguration() 分配 Angular 色。
cloudant: {
'apikey-01beebbe10ae46ad9e86cc16a2937939': [ '_replicator', '_writer', '_reader' ],
'apikey-3044abd26f324792a8be5809a5521400': [ '_writer', '_reader' ],
'apikey-8d98aa26f1d246f6b736f313bd45d630': [ '_writer', '_reader' ],
'apikey-231cdadcf38945e9ab48125adddc0fdb': [],
'apikey-7ec3ebdd9c5b4aa691685fae251a255d': [ '_writer', '_reader' ],
'apikey-061e3a0ae05d486583dda500ee6685f6': [ '_writer', '_reader' ],
'apikey-0324472243bd4c0da6ea6e9022e102c8': [ '_writer', '_reader' ]
}
"result": {
"userCtx": {
"roles": [],
"name": "apikey-01beebbe10ae46ad9e86cc16a2937939"
},
"ok": true,
"info": {
"authentication_handlers": [
"iam",
"cookie",
"default",
"local"
],
"authenticated": "default",
"authentication_db": "bm-cc-us-south-18/users"
}
}
Angular 色数组为空!
localDB.replicate.to(https://<apikey>:<pass>@<cloudantURL>/<dbname>
).on('complete', function () {
// yay, we're done!
}).on('error', function (err) {
// boo, something went wrong!
});
我得到错误:
message: "You are not authorized to access this db."
最佳答案
正如您所发现的,Cloudant 允许您创建可以访问一个或多个数据库的 api-key/password 对。您可以为每个数据库设置每个 API key 的权限,就像您已经完成的那样。GET /session
端点(您正在使用 service.getSessionInformation()
JavaScript 函数访问)不会在 roles
中返回 API key 的权限数组,但不要被推迟 - 您的 API key 确实具有您在第一步中定义的权限,因此您应该能够使用该 API key 正常读取/写入/查询数据。
请注意,此身份验证机制与 CouchDB 样式的 _users
是分开的。数据库。
例如使用 PouchDB
const PouchDB = require('pouchdb')
const db = new PouchDB('test')
const username = 'apikey-somevalue'
const password = 'somepassword'
const hostname = 'myhost.cloudant.com'
const dbname = 'pouch'
const remoteDB = `https://${username}:${password}@${hostname}/${dbname}`
db.sync(remoteDB).on('complete', async function () {
console.log('done')
const docs = await db.allDocs()
console.log(docs)
}).on('error', function (err) {
console.error(err)
});
关于javascript - 如何在 Cloudant 的 _user 数据库中分配 Angular 色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69651388/
向 Couchdb 添加新用户时,是否适合在同一个文档中添加额外的配置文件字段? 我知道我可以有另一个带有用户配置文件的数据库来补充 _users 文档中的内容,但是 _users 文档的设计是静态的
我正在使用 jquery.couch.js 在我的 Sproutcore 应用程序中注册/登录/注销到 CouchDB _users 数据库。有人知道更改用户 _id 和密码的方法吗? 最佳答案 据我
我想限制用户权限,以便普通用户只能读/写自己的用户文档。 我设法设置了写入权限,以便用户只能编辑他们自己的文档(通过设计文档中的 validate_doc_update 函数)。 现在我只需要限制用户
我正在尝试将数据保存在指针字段的解析中,而我正在尝试收到以下错误 invalid type for key Users, expected *_User,but got string 我的代码如下 p
如中所述:http://www.kernel.org/doc/htmldocs/kernel-hacking.html#routines-copy这个功能“可以” sleep 。 那么,在使用此函数时
我已经创建了 _users 数据库以及 _security 文档,并根据 https://cloudant.com/for-developers/faq/auth/ 适当设置了安全性。 。 然后,我创
Parse.com JS documentation状态: The Parse.User class is secured by default. Data stored in a Parse.Use
问题 我一直在尝试从当前用户 (Parse.User.current()) 更新字段 (gamesArray),因此稍后在另一个 View 中我可以看到它。问题是,当我这样做时,该字段会更新(我在保存
这可能是个糟糕的问题,但我很好奇为什么 Parse 会将其默认用户表命名为 _User。当我第一次使用 parse 时,我花了大约 3 个小时试图弄清楚为什么我的查询没有返回到该表。 只有当我将鼠标悬
我在访问 SocialEngine 中的 _users 表时遇到了(简单?)问题。要访问 SE4 中的表,我使用这个: $table = Engine_Api::_()->getDbTable(tab
我在访问 SocialEngine 中的 _users 表时遇到了(简单?)问题。要访问 SE4 中的表,我使用这个: $table = Engine_Api::_()->getDbTable(tab
我正在尝试检索用户数据以使用对象 ID 从 _User 类获取用户信息。我用过这个: var data:NSMutableArray = NSMutableArray() func loadData(
保存PFObject时出错: invalid type for key fromUser, expected map, but got *_User private func makeFriendRe
如何向 Cloudant 用户数据库中的用户添加 Angular 色?(_users) 我无法使用 Google 或 Cloudant Docs 解决这个问题。 我看到有人提到 Cloudant _u
我正在尝试测试 App.jsx import getUserInfo from './services/user'; const App = () => { const [isLoading, s
我试图从 parse.com 的 _User 表中删除一名用户,但出现错误。 我确定请求的语法正确,但我收到此错误: code: 206 error: "Parse::UserCannotBeAlte
我正在尝试从从另一个域连接到 CouchDB 的应用程序中更改用户密码。我的代码或多或少与 CouchDB Docs 中的示例相同。 ,即获取文档,更改数据,然后将更改的 PUT 请求发回。 PUT
我想就如何为我的 CouchDB 应用程序构建用户数据获得一些建议。 以下是我们正在构建的内容:我们正在创建一套应用程序(主要利用 html5 的视频 api)来训练人们掌握不同的技能。我们将从一些简
如果我插入任何新列,它会显示错误#1067。如果我删除最后六列,那么我可以添加,但再次无法输入第 6 列。 最佳答案 在表中的 registerDate 列中,您必须删除默认值。因为它对于给定类型来说
我正在使用 swift 和 Parse 开发一个应用程序。由于某些原因,我在 _User 类中实现了一个名为“modified”的 Bool。几个月来我一直在研究 swift 和 Parse,但这没有
我是一名优秀的程序员,十分优秀!