pondersource / sciencemesh-php

Connect your Nextcloud server to Sciencemesh
MIT License
0 stars 1 forks source link

Ability to enable for just a group of users, not for all users on the server #181

Closed mrvahedi68 closed 1 year ago

mrvahedi68 commented 1 year ago

Select groups in the administration panel of Siencemesh and enable the app only for users of these groups.

michielbdejong commented 1 year ago

I did find this: https://github.com/owncloud/core/blob/ab9763b2b4d27a221bf12005eddd2bb7d319d286/lib/private/App/AppManager.php#L227 That might work out-of-the-box on Nextcloud, but not on ownCloud because there we have a switch in config.php that determines whether the server will try to use the app. So if that switch is globally set to true, and the app is then disabled for some users, it would just lead to a 'class not found' error.

michielbdejong commented 1 year ago

So this code works around the 'enabled' column in the oc_appconfig database table. You can start by adding a JSON-encoded array of group names there, and then calling the isAppEnabledForUser function inside the SciencemeshShareProviderFactory. You should see that the app is not enabled if the user is not in the group.

Once you have that confirmed on both NC and OC-10 you can add the consequence to that: if the app is not enabled, then just refer to the existing default ShareProviderFactory.

parhamin2010 commented 1 year ago

Here's the guide for having this feature on Apps in Nextcloud: You can find it under Settings > apps image

And OwnCloud: image