Hide a custom action

Hide a custom action

Can we hide a custom action according to userid?
And can we apply a custom action in specific view and not to another?
Thank you