我应该如何在Cassandra中实现数据访问/权限管理 [英] how should I implement data access/rights management in Cassandra

查看:93
本文介绍了我应该如何在Cassandra中实现数据访问/权限管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个SaaS应用程序,用户可以在其中创建广告列表。

I am making a SaaS application in which users will create advertisement listings.


  1. 我注册的所有用户都应可以看到所有广告用户和未注册的访问者

  2. 只有注册用户才能创建广告

  3. 注册用户可以创建多个广告

  4. 只有创建广告的用户才可以删除或编辑它。

  1. All advertisements should be visible to all users of my registered users as well as unregistered visitors
  2. Only registered users can create an advertisement
  3. A registered user can create several advertisements
  4. Only the user who creates the advertisement should be able to delete or edit it.

我从未进行过用户和数据管理wrt数据库,所以我需要有关如何实现它的建议(我承认这是一个开放性问题,但是我仍然觉得它很重要,因为还有其他地方可以问我!!)

I have never done user and data management w.r.t. a database so I need advice on how I should implement it (I acknowledge that this is an open question but I still feel it is relevant as where else could I ask!!)

我的数据库是 cassandra


  • 我正在考虑对所有广告
    使用单个键空间来寻址第1点

  • 我正在考虑为将存储其广告的每个用户
    创建一个专用键空间(point#2,point#3
    和point#4)。

  • 如果用户编辑/删除广告,则需要更改
    用户特定的键空间和所有广告
    的全局键空间

问题1-我的方法是创建此类应用程序的常用方法吗?如果不是这样,我将对替代设计的建议表示赞赏。

Question 1 - Is my approach the usual way of creating such an application? If not, I'll appreciate suggestions on alternate designs.

问题2-在创建用户特定的键空间时,我能够以编程方式创建键空间(用户提供的用户名和密码)作为我的Web注册过程的一部分?

Question 2 - As I'll create user specific keyspaces, would I be able to programatically create a keyspace (with user's provided username and password) as part of my web signup process?

推荐答案

在Cassandra中每个用户的键空间都不是一个好主意,这只有在有几个用户的情况下才有效。各个键空间意味着您要为每个用户创建一个单独的表格,因此这与要点1相矛盾-显示要从所有表格中读取的所有广告。而且Cassandra在支持的表数方面也有限制-群集中建议的值不要超过500表(请参见此答案以了解更多详细信息)。

It's not good idea to have per user keyspace in Cassandra, this will work only if you have a couple of users. The individual keyspaces will mean that you're creating a separate tables for every user, so it will contradict the point 1 - to show all advertisements you'll need to read from all of tables. And Cassandra also has limitations on number of tables that it can support - recommended values are not more 500 tables in cluster (see this answer for more details).

我建议仅将用户ID用作分区键或分区键本身的一部分-但这取决于其他因素,例如用户可以创建多少个广告,等等。-这需要单独问题。

I recommend just to put user ID as a part of the partition key, or partition key itself - but this will depend on the other factors, like, how many advertisements can user create, etc. - this requires a separate question.

我建议在 DataStax学院只是为了更好地了解如何为Cassandra建模数据。

I suggest to take DS220 course on Cassandra data modelling at DataStax Academy just to get better understanding how to model data for Cassandra.

这篇关于我应该如何在Cassandra中实现数据访问/权限管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆