mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 10:55:56 +03:00
[GH-ISSUE #1038] Exclude files for Users Only (reply fast !important) #665
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#665
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xololunatic on GitHub (May 7, 2023).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/1038
Can anyone tell me a way to exclude files only for user and not the admin account? If there is please tell me what to do to set it up and if not I request the admin @prasathmani to implement that, which will be much useful and should also be easy to implement I think ...
@ner00 commented on GitHub (May 27, 2023):
It's relatively easy, although an experienced user could still mess around if he knows the name of the files being hidden.
Anyway, this is the current code that checks if excluded files should be visible in the file manager:
github.com/prasathmani/tinyfilemanager@f380478197/tinyfilemanager.php (L2572-L2575)The code above obviously is as direct as possible since it never intended for distinctions other than the excluded items, regardless if the user is admin or read-only. If we invert the logic, make it either/or, wrap it around parenthesis and add a check for read-only user, then it would work like this:
I didn't think about this thoroughly, so it may be that this breaks something, although it shouldn't.
Give it a try and leave some feedback, please.
@xololunatic commented on GitHub (May 28, 2023):
@ner00 I will try that and will update you soon .... But what I really wanted is let's say i added 2 users (except admin) (readonly) (user1 and user2) and specifically i want to exclude a file let's say login.php for user2 and not for user1 .. that means user2 should not be able to see login.php but user1 can.. In short can we separately exclude different files for each user... It would be best if it may be done in config section... If i succeeded to make you understand then tell me what could be done, if you don't then tell me.....I can explain again
@ner00 commented on GitHub (May 28, 2023):
I don't understand what you mean by that, if you mean to add/remove users with access in the settings menu then I don't think it is worth the extra work to implement that. Because you still need to add users and passwords manually, you still need to add excluded files and extensions manually, so in the end that's too much work for little to no gain at all.
A simpler and general solution requires a bit more code than the previous example but works in essentially the same way, just create a new array named something like
$exclude_items_usersand put inside the names of the users that you don't want to be able to view the excluded files, then instead of checking for read-only, check for current user.For simplicity, here is a commit with the needed changes:
github.com/prasathmani/tinyfilemanager@571e0ddfa7...or a diff view:
@ner00 commented on GitHub (May 28, 2023):
If I understand that correctly, then yes. You will need a multidimensional array to map excluded files to specific users. Here's a commit with the needed changes:
github.com/prasathmani/tinyfilemanager@21d6a134b7github.com/prasathmani/tinyfilemanager@1301b27e0e...or a diff view:
@ner00 commented on GitHub (Jun 11, 2023):
Close this due to lack of response from OP.