best way to implement laravel database system to manage posts read/share/edit permissions - database

Thank you for helping on this!
I am designing an app with documents and posts sharing with Laravel.
I tried to do it myself since two weeks but I am not sure what the best is.
I've tried implementing many packages and used crud generators, but as a Laravel beginner it's difficult to find the good package and to mix them.
What I want is a system like google docs sharing behaviour but for posts.
You could write a post and set it as
private
shared with those with the secret link
shared with users names list (or ids in database)
shared with groups of users
So what is the best way to build that?
1) Using a package? Which one?
2) table_users | table_posts | table_permissions
one permission per user that can read / edit (permission level)
3) table_users | table_posts including permissions for each posts
owner_id
share_link
users_that_can_read
users_that_can_edit
If anyone can direct me to a good tutorial or give me a good start structure for this tables to be efficient and secure.
Maybe I do not see all the complexity of this so I will enjoy any suggestions
The problem for this is I want a more flexible rights management than wordpress one that provides user rights levels, the availability of data will be managed by simple subscribers for a lot of things(files, posts, maybe comments, groups and maybe more stuff).

You just need to create three tables roles,permissions and roles_permission.The roles of the user goes in the table roles table.the permission of a user are stored in the table permission.You can map the roles and permission of a particular user in the roles_permission table.However,for more flexible way to add role-based-permission use entrust package.In which,you can dynamically add/update/delete the roles and permissions in laravel.

Related

Unloading data from Views with minimal permissions

I'm a newbie to Snowflake. I'm assigned task to make python script that gets data from Snowflake View and copies it to SFTP server. I have barely any permissions on that account (can only view the shared Views).
Now my 2 questions:
Can admin grant me permission to creating internal stages without granting me any more permissions? (I want to ask the admin to give me that permission, but he won't be willing to share anything more with me.)
Can I use COPY INTO command on Views? All examples I read on the internet were about Tables and not Views and I'd like to be sure I can copy Views before asking for any permissions.
I apologize if those questions sound silly, but I have no way of testing those myself as I have no permissions on that account and I need to be sure before negotiating anything with admins.
Yes, that can be done. Also, you can look at the following documentation which details about Unload operation : docs.snowflake.com/en/user-guide/data-unload-overview.html

How to locate user tables in another database for multisite-single-login

I am developing multi-sites with drupal.
I have to take care of 10 sites and they need single login
I supposed I need to create separate user database to support that
feature.
i.e 10 sites, 10 database and +1 user database.
Where should I look and modify? User Module? Which lines?
Normally database settings are in settings.php file .
I had export the database and make and working user-database already.
Please kindly try to explain in details thanks.
I don't know the full details of your situation but it sounds like you might benefit from one database with prefixed tables and a shared user table.
See
http://thedrupalblog.com/setting-multi-site-drupal-6-installation-shared-databases-and-single-sign and http://drupal.org/node/201673 (bit outdated but may still be helpful)

1 data, many applications

I have a forum with >400 registered users. It's powered by vBulletin-4.0.4. I want to build up several websites with kohana-3.1, but keep existing forum users too. I will use seperate databases for each application (I want to keep apps as independent as possible).
So my solution is:
step 1. create special app users.mydomain.com where each user can register and update their details (birthdate/email/password). This app will catch all changes and write them to forum database and application databases.
step 2. modify default auth module to handle forum authentication. vBulletin uses algorithm: $hash=MD5(MD5($password)+$salt) for pass hashing.
Am I in the right direction? Is it OK?
Someone has already done this: Kohana vBulletin Bridge. You will need to contact the author of the module as the source code is no longer online. It wont be too difficult to upgrade it to 3 if you get it.
I haven't used vBulletin so I can't give you much advice on the subject, but you're right about the hashing algorithm. You'll also need to make sure your session is read and written as they are in vBulletin.
A quick search of vBulletin SSO to get you started.

create new roles in sql server 2008

I have created a database system for a cms for a news website. I want to have only 4 roles in my db system : Admin, Author, Editor and Guest ( who only read the web pages). But there are some pre-defined roles in every db system like sys and db_owner and… and they are not removable but I want the only 4 roles I mentioned above. How can I aim this goal? thanks
ah, you cannot!
Also I do not think you will need to tweak the database system. Rather, architect a good solution for your application/frontend/website.
as far as i am aware, you can't modify those roles (besides adding logins to them). instead of working around them, you could try using them, it might make life a little bit easier.

Best way to be done? Subdomains and MySQL

I'm asking your opinions about my next project..
I'm planning to make website which offers services where all users would be have own subdomain (user.mydomain.com) and own website.
First I was thinking to really make real subdomain, generating automatically website code into their folder, creating own database etc..
Question #1: When I need some information from all subdomains databases in my main page (mydomain.com), how can I fetch those?
Would it be better way just use one database and dynamic code what all users are using but then re-write address like it would be subdomain (mydomain.com?user=myuser -> myuser.mydomain.com)
If someone have experience with something like what I was planning, would be nice to have tips and tricks do it right! :)
Thanks!
It will be alot of less code to maintain in you have one common codebase for all users, that just reads the domain name and uses that information.
Imagine that you discover an error in the code that was generated for one of the subdomains.
Either you would have one place to correct, or you would have 1 place + the number of users to correct.
You'll probably want all of the subdomains to point to the same codebase and treat the subdomain as an argument that is pulled out and identifies which instance of this application it is. You'll need a table in your db that will store information about each instance and then user accounts, user data, etc will all be tied back to a specific instance.

Resources