private static string GetGroupName(AuthorizedCommand command) { var groupAttribute = command.GetType().CustomAttributes .FirstOrDefault(x => x.AttributeType == typeof(GroupAttribute)); var groupName = groupAttribute.ConstructorArguments[0].Value as string; return(groupName); }
public UnauthorizedCommandUsageException(AuthorizedCommand command, IEnumerable <string> authorizedRoles) : this(GetGroupName(command), authorizedRoles) { }