How to restrict Users to see only their databases where has access?

I need to restrict the list of database for our users in a SQL Instance In order to move forward this I revoked the view any database permission to the user desired. But I figured out that only applies for databases owners so if you have access to a database but noy like db_owner even if for this user you deny "view any database". Keep listed the database on the instance

I would like to know how I can restrict to the users to only see their databases where are owners and also databases where only have access.

USE [MASTER] GO DENY VIEW ANY DATABASE TO [MYACCOUNT] GO 

how to script out database users and permissions in all user databases in the instance

Can anyone help please?

I would like to use Steve Kusen’s script at https://www.sqlservercentral.com/forums/topic/script-db-level-permissions/page/4/#post-1954202

to loop through all the user databases automatically, using Aaron Bertrand’s sp_ineachdb. Has anyone got this to work? Kindly advise on how to do it please.

Thank you

View users by filter

I’m trying to display a list of members on my site in a way that looks similar to what this site does: https://cgli.net/members

With all these user filters (by country, groups, area…), is there a WordPress plugin that does this?

AAD users lose access to database after import

I googled for the last few days but I got a bit confused and I do not know how to proceed further. Also, I’m not a DBA and I was just faced with this situation for the first time. Using sqlpackage.exe I’m exporting a bacpac from a PRD DB and import it on another server to refresh the lower environments. The original database is contained. After I’m importing the new database, the contained database users and the AAD external ones lose access to the new database. I’m fixing the contained database user by updating its password with

ALTER USER [RandomUser] WITH PASSWORD='randomPassword' 

but I am not sure what to do with the AAD users. They have an external user created for them (the aad users are placed inside a group). So far my option is to drop the said user and recreate it

CREATE USER [sthRandom] FROM EXTERNAL PROVIDER 

but in order to do this, you have to be connected with an AAD user

Principal 'sthRandom' could not be created. Only connections established with Active Directory accounts can create other Active Directory users. 

I have to automate this whole process so I could use a service principal like this. I’m creating the service principal inside all the databases, but after refresh the user won’t exist anymore, or I create it in the PRD database too, but I can not use it to login anymore.

What other options do I have? Thanks

Twittext.com – blogging platform for Twitter users

This project has great potential to be a source of high traffic from Google and Twitter and user-written content on various topics in many languages

What is this project about?
With Twittext you can publish text, write your blog, or just read texts from people you follow on Twitter. In just three clicks (login, new text, publish), you can publish your text on the web and share it on Twitter. Screenshots from the application can be seen at this link…

Twittext.com – blogging platform for Twitter users

how to get users with usermeta include array of an array

i have a user_meta for users that them is array like below:

user_saved_posts = [31289,31482,27641] 

and i want to get users that their user_meta include an item of an array like below:

goal_posts = [31289,31422,77641,41289,21482,17641] 

if user have an item of goal_posts array must returned them. i use below code but this code worked if i have a value for search in user_meta

$  args = [         'meta_query' => [             [                 [                     'key' => 'saved_posts',                     'value' => sprintf(':"%s";', 31289),                     'compare' => 'LIKE'                 ]             ]         ]     ];     get_users($  args); 

Redirect users from admin pages the optimal solution

On two different sites I use two somewhat different solutions. Are they different in terms of security and performance? Which is better? Are there even better ones?

Solution 1.

/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! current_user_can( 'manage_options' ) && ( ! wp_doing_ajax() ) ) {         wp_safe_redirect( site_url() );         exit;     } } ); 

Solution 2.

/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! in_array( 'administrator', wp_get_current_user()->roles ) ) {         wp_redirect( get_bloginfo( 'wpurl' ) );         exit;     } } ); 

In Multisite the users profile picture keeps disappearing for “the other site”

I have the following setup: Site A with Domain A and Site B with Domain B

Site A is set to be the main site.

The users’ profile pictures have all been set via Site A and therefore Domain A. They do show under "Network Admin > Users", but they don’t show under "Site B > Users".

If I now set an image for profile XYZ under "Site B > Users", the URL for that profile pic changes to Domain B in the users table and there is no image anymore displayed for profile XYZ under Network Admin nor under Site A.

Any idea what the issue might be and is there a way around that?