I am writing a repository program in java, I have a User table that contains the users of repository and a File Table that contains all the imported files in repository, in MYSQL database.How can I set access privileges of my files to users?In fact how can I determine which user have witch access privilege(read,write,read and write) to which file in repository?
Thanks
If you’re writing a file repository then file access privileges should be a concept of your mocel. Wouldn’t you usually have a dedicated user for running the file repository program and all of the files would have privileges of that user.
Then the program after authorising the user would read from it’s database table what kind of privileges do users have to the files they want to fetch.
Since you’re storing files physically in the database as BLOB objects then you should create another table that will store user privilages to these files.
Then whenever you want to check whether a user has read permission to a file you do