You do this in the _isAvailable
method you implemented in your command Javascript, optionally you can also do this in the _isEnabled
method.
In there you will have to check what Group the User belongs to. To get the current User and its Groups you can use the following:
var settings = Tridion.UI.UserSettings.getJsonUserSettings(true);
if (settings)
{
var groups = settings.User.Data.GroupMemberships;
}
Now the groups
parameter will be be an object array containing the Groups the current User belongs to, they are formatted as JSON with a type
, title
and href
(the TCMURI).
Now please note that Administrator users are usually not assigned to any Groups specifically (because they have all rights coming from their Administrator status already). Such a user will also not have an array of Groups in its GroupMemberships
, but that will just contain one object (being thethe Group "Everyone" for an Administrator).
To identify if a user is an Administrator, you can check out settings.User.Data.Privileges
, that will have the value 1
(for an Administrator).