WS : Use /api/user_properties API by the admin to modify another user's properties

44 views
Skip to first unread message

Laurent Tourreau

unread,
Jan 20, 2016, 6:58:51 AM1/20/16
to SonarQube
Hi guys

Is it possible to use /api/user_properties by the admin to modify another user's properties?

Laurent TOURREAU

Teryk Bellahsene

unread,
Jan 20, 2016, 8:09:02 AM1/20/16
to SonarQube
Hi Laurent,

It's not possible to modify another user's properties. Could you explain why you'd need to do that?

Thanks,

Teryk

Laurent Tourreau

unread,
Jan 20, 2016, 9:05:48 AM1/20/16
to SonarQube
Hi Teryk

As SonarQube admin, we want to force "My News issue" notification properties on all users.

We want all our issues warned when they introduce issues.

Regards

Laurent TOURREAU

mjdet...@gmail.com

unread,
Jan 20, 2016, 12:28:19 PM1/20/16
to SonarQube
+1 for this ability.  Same use case.  I was actually about to write a script for this but looks like you saved me some time!

Regards,
Matthew DeTullio

mjdet...@gmail.com

unread,
Jan 20, 2016, 8:38:59 PM1/20/16
to SonarQube, mjdet...@gmail.com
As a workaround, you can run this SQL directly against the database (this is for MySQL).  It will enable the global My New Issues property for any user who does not already have it enabled.

Use at your own risk!

INSERT INTO properties (prop_key, resource_id, text_value, user_id) SELECT DISTINCT 'notification.SQ-MyNewIssues.EmailNotificationChannel', NULL, 'true', id FROM users WHERE id NOT IN (SELECT DISTINCT user_id FROM properties WHERE prop_key = 'notification.SQ-MyNewIssues.EmailNotificationChannel');

Laurent Tourreau

unread,
Jan 21, 2016, 6:28:23 AM1/21/16
to SonarQube, mjdet...@gmail.com
Hi Matthew

It is what we are doing now.
Thanks for your SQL code.

Regards

Laurent

Teryk Bellahsene

unread,
Jan 26, 2016, 3:39:44 AM1/26/16
to SonarQube

Laurent Tourreau

unread,
Jan 26, 2016, 3:44:58 PM1/26/16
to SonarQube
Voted!
Thanks for your reply.
Laurent
Reply all
Reply to author
Forward
0 new messages