file permision

Permalink
there is no way I can add permission per file and not per file set , programmatically ?

 
mnakalay replied on at Permalink Reply
mnakalay
Actually I think you can.
Look in ROOT/concrete/core/models/permission/assignments/file.php

That's the file responsible for that I believe.
JLPaliuca replied on at Permalink Reply
Yes maybe, but in their documentation in the file controller, there is a function called setPermissions($obj, $canRead, $canSearch, $canWrite, $canAdmin), which i think it was on the previous versions, but now there is no such function in File controller, but the same function exists in file set controller, and also in collection controller.
JLPaliuca replied on at Permalink Reply
ps:
where the $obj could be a user or a group
mnakalay replied on at Permalink Reply
mnakalay
Sorry I am not sure what you are referring to. There is no file controller and I can't find a setPermissions function anywhere (I have 5.6.2.1)

In the file I have mentioned above however there is a public setPermissionObject function that I believe does just what you want.
JLPaliuca replied on at Permalink Reply
http://www.concrete5.org/documentation/developers/files/files-and-file-versions

check this
JLPaliuca replied on at Permalink Reply
and why i need this is because, when a page is published by the admin, so to say, i want to grand permissions to the files I`m uploading for that collection to some users and them only, so that when they edit that page in composer to have access to those files, and only to those files and of course to the files that they are uploading them selfs
mnakalay replied on at Permalink Reply
mnakalay
I see what you mean but then why don't you just put all those users in a group and give that group access to those files?
You would have a group per page I suppose but it would be easier I think (If I understood correctly what you want)

Concerning the permission function, I was not able to find out how to do what you want. I don't see how to set permission other than for the current user.
I must be overlooking something.
mnakalay replied on at Permalink Best Answer Reply
mnakalay
ok I looked and looked and looked and here's the best I could find:
Look in the file ROOT/concrete/helpers/concrete/upgrade/version_560.php
Around line 795 you have the function migrateFilePermissions() that shows you how to assign permissions per file and per user.

Beware, it's complex!!!
JLPaliuca replied on at Permalink Reply
thank you, and that advice about user groups is not viable for what I need, to many groups are to be created, I`m talking about hundreds of users, and per page i need to give permission to 2 or 3