How to setup direct download links in Seafile Pro?

Has the admin role been assigned to the user?

Yes sure. He is admin

…
NABLED_ROLE_PERMISSIONS = {
‘admin’: {
…

Hi,

perhaps it’ got lost when you wrote the post, but shouldn’t it be ENABLED?

Just in case you are using shibboleth, I’m missing the mapping from affiliations to roles in your seahub_settings.py:

SHIBBOLETH_AFFILIATION_ROLE_MAP = {
    'employee@...':         'employee',
    'faculty@...':          'employee',
    'staff@...':            'employee',
    'student@...':          'default',
    'guest@...':            'guest',
    'librarywalkin@...':    'guest',
}

But wether you use shibboleth or not, to make sure, that Seafile has assigned the admin role, use this mysql statement:

SELECT * FROM ccnet-db.UserRole WHERE email ='MAILADDRESS_OF_YOUR_ADMIN';

(Edit: There should be “`” around ccnet-db.UserRole, but the markup absorbed the two characters)

Best regards

Thomas

Yes there set ENABLED.

We do not useshibboleth and do not know what is it, sorry.

Answer is:

MariaDB [(none)]> SELECT * FROM “ccnet-db.UserRole” WHERE email =‘xxxxxxxx@xxx.xx’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘-db.UserRole WHERE email =‘xxxxxxxx@xxx.xx’’ at line 1
MariaDB [(none)]>

Maybe file seahub_settings.py will help in my problem?

You should not publish your secret key.

1 Like

shoeper, thanks!

So if there any solution?

Try running the following instead:

SELECT * FROM 'ccnet-db.UserRole' WHERE email ='xxxxxxxx@xxx.xx';

Looks like you’ve also shared the secret key above. If it’s production I recommend exchanging it (by assigning another random string). The consequences of that action can be found at Effects of changing Django's SECRET_KEY - Stack Overflow

Will changing the SECRET_KEY have any effect on encrypted libraries? Are they still accessible?

Yes thank you. I have changed secret key successfully. All essential operations work well )

Answer is:

MariaDB [(none)]> SELECT * FROM ‘ccnet-db.UserRole’ WHERE email =‘xxxxxxxx@xxx.xx’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘‘ccnet-db.UserRole’ WHERE email =‘xxxxxxxx@xxx.xx’’ at line 1
MariaDB [(none)]>

Where xxxxxxxx@xxx.xx is actual email adress - user of Seafile

For some reason, MySQL is picky about the hyphen in the database name, I think.

Try to specify the database when connecting:

$ mysql ccnet-db
MariaDB [ccnet-db]>

or select it within the session:

$ mysql
MariaDB [(none)]> use ccnet-db;
Database changed
MariaDB [ccnet-db]> 

in both cases, you can then use

MariaDB [ccnet-db]> SELECT * FROM UserRole WHERE email LIKE "schlarbm%";
+------+-----------------------+----------+
| id   | email                 | role     |
+------+-----------------------+----------+
| 7650 | schlarbm@xxx.xx       | employee |
+------+-----------------------+----------+
1 row in set (0.00 sec)

I have tried this one. Answer below:

Database changed
MariaDB [ccnet_db]> SELECT * FROM UserRole WHERE email LIKE “xxxxxxxx@xxx.xx”;
Empty set (0.01 sec)

From your UserRole info from mysql, I see “xxxxxxxx@xxx.xx” user has not been setted a role, in this case Seafile will use the default role for the user, so the “xxxxxxxx@xxx.xx” user with default role can NOT generate share/upload links:

(this is the settings you posted above)

   'default': {
       'can_add_repo': True,
       'can_add_group': True,
       'can_view_org': True,
       'can_use_global_address_book': True,
       'can_generate_share_link': False,
       'can_generate_upload_link': False,
       'can_invite_guest': False,
       'can_connect_with_android_clients': True,
       'can_connect_with_ios_clients': True,
       'can_connect_with_desktop_clients': True,
   },

Just set “xxxxxxxx@xxx.xx” user’s role to amdin, or chang the permission of can_generate_share/upload_link to True for default role in seahub_settings.py

This user is admin definitely.

For verification I have created new user and added him to admin group. There still the same thing - I can only share files and folders with Seafile users.

I can change the permission of can_generate_share/upload_link to True for default role in seahub_settings.py for testing but it will not solve the problem indeed.

Have done!

I have added admin role section in config file and now it works well. ĐĄontinue to test.

Anyway thanks for help!

admin group != admin role

From the image one can see that the role is ignored. In which file have you add the role. Is it conf/seahub_settings.py?

Are there errors in logs/seahub_django_request.log?

Yes that is seahub_settings.py.

I see no errors seahub_django_request.log by now